All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@google.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Andy Lutomirski <luto@amacapital.net>,
	regressions@leemhuis.info, linux-crypto@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Lutomirski <luto@kernel.org>
Subject: Re: vmalloced stacks and scatterwalk_map_and_copy()
Date: Mon, 21 Nov 2016 10:08:14 -0800	[thread overview]
Message-ID: <20161121180814.GA30672@google.com> (raw)
In-Reply-To: <20161121082619.GA6462@gondor.apana.org.au>

On Mon, Nov 21, 2016 at 04:26:19PM +0800, Herbert Xu wrote:
> 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 <ebiggers@google.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> 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);

This looks fine to me if you're confident that the aliasing check is indeed no
longer necessary.

Another idea I had was to replace memcpy() with memmove().  But I don't want to
be in a situation where we're stuck with memmove() forever because of users who
probably don't even exist.

Eric

      reply	other threads:[~2016-11-21 18:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 18:16 vmalloced stacks and scatterwalk_map_and_copy() Eric Biggers
2016-11-03 20:30 ` Andy Lutomirski
2016-11-03 21:12   ` Eric Biggers
2016-11-03 23:10     ` Eric Biggers
2016-11-03 23:10       ` Eric Biggers
2016-11-04  3:57       ` Andy Lutomirski
2016-11-04  3:57         ` Andy Lutomirski
2016-11-04 17:05         ` Eric Biggers
2016-11-04 17:05           ` Eric Biggers
2016-11-21  2:19   ` Andy Lutomirski
2016-11-21  8:26     ` Herbert Xu
2016-11-21 18:08       ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121180814.GA30672@google.com \
    --to=ebiggers@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=regressions@leemhuis.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.