lkml.org 
[lkml]   [2017]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] crypto: AF_ALG - wait for data at beginning of recvmsg
On Wed, Nov 29, 2017 at 11:28:43AM +0100, Stephan Mueller wrote:
> Am Mittwoch, 29. November 2017, 11:22:34 CET schrieb Herbert Xu:
>
> Hi Herbert,
>
> > On Wed, Nov 29, 2017 at 11:17:26AM +0100, Stephan Müller wrote:
> > > @@ -111,6 +111,12 @@ static int _aead_recvmsg(struct socket *sock, struct
> > > msghdr *msg,>
> > > size_t usedpages = 0; /* [in] RX bufs to be used from user */
> > > size_t processed = 0; /* [in] TX bufs to be consumed */
> > >
> > > + if (ctx->more) {
> > > + err = af_alg_wait_for_data(sk, flags);
> > > + if (err)
> > > + return err;
> > > + }
> >
> > So what happens when sendmsg hasn't been called at all? In that
> > case ctx->more would be zero, and we would skip the wait right?
>
> Right, but wouldn't that be the correct order of operation? If somebody does
> not call sendmsg, he simply did not send any data. And that is yet a proper
> operation (for encryption) as it obtains the tag for the "null" data.

Well no. Up until now we have supported (although to a limited
extent) having two threads do recvmsg/sendmsg in parallel. So
if the first thread executed recvmsg it should wait until the
second thread executes sendmsg.

Obviously this support is not complete as we have seen with ctx->enc
overwrites but we shouldn't break what used to work.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2017-11-29 11:44    [W:0.541 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site