[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120113110255.GD12501@secunet.com>
Date: Fri, 13 Jan 2012 12:02:55 +0100
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
Alexey Dobriyan <adobriyan@...il.com>,
linux-crypto@...r.kernel.org, netdev@...r.kernel.org,
ken@...elabs.ch
Subject: Re: sha512: make it work, undo percpu message schedule
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@...dor.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@...il.com>
> > Signed-off-by: Herbert Xu <herbert@...dor.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists