From patchwork Mon Nov 21 08:26:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 9439001 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74EBE60235 for ; Mon, 21 Nov 2016 08:26:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D2032890E for ; Mon, 21 Nov 2016 08:26:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5194528915; Mon, 21 Nov 2016 08:26:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA8AC2890E for ; Mon, 21 Nov 2016 08:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbcKUI0m (ORCPT ); Mon, 21 Nov 2016 03:26:42 -0500 Received: from helcar.hengli.com.au ([209.40.204.226]:43599 "EHLO helcar.apana.org.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752682AbcKUI0l (ORCPT ); Mon, 21 Nov 2016 03:26:41 -0500 Received: from [192.168.128.4] (helo=gondobar) by fornost.hengli.com.au with esmtp (Exim 4.80 #3 (Debian)) id 1c8jvq-00074v-D2; Mon, 21 Nov 2016 19:26:30 +1100 Received: from herbert by gondobar with local (Exim 4.84_2) (envelope-from ) id 1c8jvf-0001h5-Av; Mon, 21 Nov 2016 16:26:19 +0800 Date: Mon, 21 Nov 2016 16:26:19 +0800 From: Herbert Xu To: Andy Lutomirski Cc: Eric Biggers , regressions@leemhuis.info, linux-crypto@vger.kernel.org, "linux-kernel@vger.kernel.org" , Andrew Lutomirski Subject: Re: vmalloced stacks and scatterwalk_map_and_copy() Message-ID: <20161121082619.GA6462@gondor.apana.org.au> References: <20161103181624.GA63852@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sun, Nov 20, 2016 at 06:19:48PM -0800, Andy Lutomirski wrote: > > > Herbert, can you clarify this? The check seems rather bizarre -- > > you're doing an incomplete check for aliasing and skipping the whole > > copy if the beginning aliases. In any event the stack *can't* > > reasonably alias the scatterlist because a scatterlist can't safely > > point to the stack. Is there any code that actually relies on the > > aliasing-detecting behavior? Well at the time the IPsec stack would pass an IV that pointed into the actual request, which is what prompted that patch. The IPsec code has since been changed to provide a separate IV so this check is no longer necessary. I will remove it with this patch. ---8<--- crypto: scatterwalk - Remove unnecessary aliasing check in map_and_copy The aliasing check in map_and_copy is no longer necessary because the IPsec ESP code no longer provides an IV that points into the actual request data. As this check is now triggering BUG checks due to the vmalloced stack code, I'm removing it. Reported-by: Eric Biggers Signed-off-by: Herbert Xu diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 52ce17a..c16c94f8 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c @@ -68,10 +68,6 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, sg = scatterwalk_ffwd(tmp, sg, start); - if (sg_page(sg) == virt_to_page(buf) && - sg->offset == offset_in_page(buf)) - return; - scatterwalk_start(&walk, sg); scatterwalk_copychunks(buf, &walk, nbytes, out); scatterwalk_done(&walk, out, 0);