netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-crypto@vger.kernel.org, netdev@vger.kernel.org,
	ken@codelabs.ch
Subject: Re: sha512: make it work, undo percpu message schedule
Date: Fri, 13 Jan 2012 12:02:55 +0100	[thread overview]
Message-ID: <20120113110255.GD12501@secunet.com> (raw)
In-Reply-To: <1326450942.2272.20.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Fri, Jan 13, 2012 at 11:35:42AM +0100, Eric Dumazet wrote:
> Le vendredi 13 janvier 2012 à 18:08 +1100, Herbert Xu a écrit :
> > On Fri, Jan 13, 2012 at 02:55:14AM +0300, Alexey Dobriyan wrote:
> > >
> > > Herbert, I couldn't come up with a single scenario. :-(
> > > But the bug is easy to reproduce.
> > 
> > OK, does this patch work for you?
> > 
> > commit 31f4e55c09c1170f8b813c14b1299b70f50db414
> > Author: Herbert Xu <herbert@gondor.apana.org.au>
> > Date:   Fri Jan 13 18:06:50 2012 +1100
> > 
> >     crypto: sha512 - Fix msg_schedule race
> >     
> >     The percpu msg_schedule setup was unsafe as a user in a process
> >     context can be interrupted by a softirq user which would then
> >     scribble over the exact same work area.  This was discovered by
> >     Steffen Klassert.
> >     
> >     This patch based on ideas from Eric Dumazet fixes this by using
> >     two independent work areas.
> >     
> >     Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
> >     Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> > 
> 
> I wonder ...
> 
> With 4096 cpus, do we really want to reserve 5242880 bytes of memory for
> this function ?
> 
> What about following patch instead ?
> 
> (Trying a dynamic memory allocation, and fallback on a single
> pre-allocated bloc of memory, shared by all cpus, protected by a
> spinlock)

If we want to do dynamic memory allocation, we could place it to the
shash_desc context where we already store the intermediate digest value.
This is preallocated anyway, so we don't need to do another allocation.

  parent reply	other threads:[~2012-01-13 11:02 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:00 sha512: make it work, undo percpu message schedule Alexey Dobriyan
2012-01-11  0:12 ` Alexey Dobriyan
2012-01-11  0:36 ` Herbert Xu
2012-01-12 23:55   ` Alexey Dobriyan
2012-01-13  0:19     ` Herbert Xu
2012-01-13  7:08     ` Herbert Xu
2012-01-13 10:35       ` Eric Dumazet
2012-01-13 10:41         ` Eric Dumazet
2012-01-13 10:57           ` Eric Dumazet
2012-01-13 11:33             ` Alexey Dobriyan
2012-01-13 12:34               ` Eric Dumazet
2012-01-14 18:20                 ` Alexey Dobriyan
2012-01-14 18:27                   ` [PATCH 1/3] " Alexey Dobriyan
2012-01-14 18:40                     ` [PATCH 2/3] sha512: reduce stack usage to safe number Alexey Dobriyan
2012-01-14 19:08                       ` Linus Torvalds
2012-01-14 20:41                         ` Alexey Dobriyan
2012-01-14 21:14                           ` Linus Torvalds
2012-01-16  9:56                           ` David Laight
2012-01-16 10:20                             ` Alexey Dobriyan
2012-01-16 10:23                             ` Eric Dumazet
2012-01-16 11:37                               ` David Laight
2012-01-17 12:03                               ` Alexey Dobriyan
2012-01-18 18:02                                 ` [PATCH 4/3] sha512: reduce stack usage even on i386 Alexey Dobriyan
2012-01-26  2:35                                   ` Herbert Xu
2012-01-27 17:51                                     ` Alexey Dobriyan
2012-01-27 22:32                                       ` Herbert Xu
2012-01-30 11:10                                         ` Alexey Dobriyan
2012-02-03  3:34                                           ` Herbert Xu
2012-01-14 21:46                     ` [PATCH 1/3] sha512: make it work, undo percpu message schedule Eric Dumazet
2012-01-14 21:52                       ` Linus Torvalds
2012-01-14 22:00                         ` Eric Dumazet
2012-01-15  1:43                     ` Herbert Xu
2012-01-13 11:02         ` Steffen Klassert [this message]
2012-01-15  1:43           ` Herbert Xu
2012-01-13 11:45         ` David Laight
2012-01-13 12:35           ` Eric Dumazet
2012-01-13  6:22   ` Steffen Klassert
2012-01-13  6:46     ` Herbert Xu
2012-01-13  6:48     ` Eric Dumazet
2012-01-13  6:50       ` Herbert Xu
2012-01-13  9:45       ` David Laight
2012-01-11  1:12 ` Adrian-Ken Rueegsegger

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=20120113110255.GD12501@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=adobriyan@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ken@codelabs.ch \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).