From: Harald Freudenberger <hfreude@linux.vnet.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com>,
Gerald Schaefer <gerald.schaefer@de.ibm.com>
Subject: Re: [PATCH] s390/crypto: fix aes ctr concurrency issue
Date: Thu, 28 Nov 2013 16:39:43 +0100 [thread overview]
Message-ID: <1385653183.3131.14.camel@myubuntu10> (raw)
In-Reply-To: <20131128140045.GA32124@gondor.apana.org.au>
On Thu, 2013-11-28 at 22:00 +0800, Herbert Xu wrote:
> On Tue, Nov 19, 2013 at 11:22:12AM +0100, Harald Freudenberger wrote:
> > The aes-ctr mode used one preallocated page without any concurrency
> > protection. When multiple threads run aes-ctr encryption or decryption
> > this could lead to data corruption.
> >
> > The patch introduces locking for the preallocated page and alternatively
> > allocating and freeing of an temp page in concurrency situations.
>
> You can't use mutex_lock because you may be in a non-sleepable
> context. Perhaps just fall back to doing it block-by-block, like
> we do in aesni-intel on x86?
The first attempt to lock the mutex is done with mutex_trylock() which
should be safe for non-sleepable context. If this fails, an attempt is
made to allocate a fresh page __get_free_page(GFP_ATOMIC). If this also
fails, well what could be done then ? I think, it is valid to wait for
the preallocated page to get released with an mutex_lock(). Should I
really add code here for handling the 3rd level of the exceptional
path ?
>
> I have to say that your hardware has a funny way of doing CTR.
> Somebody was generalising out of their backside :)
>
> Thanks,
next prev parent reply other threads:[~2013-11-28 15:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 10:22 [PATCH] s390/crypto: fix aes ctr concurrency issue Harald Freudenberger
2013-11-19 10:22 ` Harald Freudenberger
2013-11-28 14:00 ` Herbert Xu
2013-11-28 15:39 ` Harald Freudenberger [this message]
2013-11-29 1:50 ` Herbert Xu
2013-11-29 8:58 ` Harald Freudenberger
2013-11-22 13:58 ` Gerald Schaefer
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=1385653183.3131.14.camel@myubuntu10 \
--to=hfreude@linux.vnet.ibm.com \
--cc=gerald.schaefer@de.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=ingo.tuchscherer@linux.vnet.ibm.com \
--cc=linux-crypto@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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