linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller-T9tCv8IpfcWELgA04lAiVw@public.gmane.org>
To: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
Cc: 'Quentin Gouchet'
	<quentin.gouchet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Daniel Borkmann
	<dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v8 1/2] crypto: AF_ALG: add AEAD support
Date: Tue, 20 Jan 2015 04:08:48 +0100	[thread overview]
Message-ID: <2322046.U2aPs8NjYq@tauon> (raw)
In-Reply-To: <20150120030017.GA10475-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>

Am Dienstag, 20. Januar 2015, 14:00:17 schrieb Herbert Xu:

Hi Herbert,

>On Fri, Jan 09, 2015 at 04:30:45AM +0100, Stephan Mueller wrote:
>> Am Donnerstag, 8. Januar 2015, 22:09:31 schrieb Herbert Xu:
>> 
>> Hi Herbert,
>> 
>> > On Wed, Jan 07, 2015 at 04:51:38PM +0100, Stephan Mueller wrote:
>> > > +		if (!aead_writable(sk)) {
>> > > +			/*
>> > > +			 * If there is more data to be expected, 
but we cannot
>> > > +			 * write more data, forcefully define 
that we do not
>> > > +			 * expect more data to invoke the AEAD 
operation. This
>> > > +			 * prevents a deadlock in user space.
>> > > +			 */
>> > > +			ctx->more = 0;
>> > 
>> > We should return EMSGSIZE here.  Also we should clear out the
>> > existing data so that the socket may be reused again.
>> 
>> Is this really wise considering that we want to support a threaded
>> caller? For example, one thread sends data and another reads data.
>> For some reason, the reading thread is throttled or slower than the
>> sender. Now, with the current solution, the sender is put on hold
>> (i.e. throttled) until the reader can catch up. I.e. we have an
>> automated synchronization between sender/receiver.
>> 
>> Thus, when we remove the wait here and return an error, the sender
>> will be shut down and there is no synchronization of the
>> reader/writer any more.
>> 
>> Note, the same applies to the very similar code in aead_sendpage too.
>
>No, if we're in this case then something seriously wrong has
>happened.  IOW the application writer has screwed up.  We're
>not able to carry out the wish of user-space because of resource
>limits on the socket.  Attempting to continue at this point will
>only cause confusion.
>
>So we should loudly declare that there was an error.

Ok. Your suggestion implies that it needs to be removed in aead_sendmsg 
and aead_sendpage. That in turn implies aead_wait_for_wmem can go as 
well.

Also, my previous suggestion with MSG_TRUNC can be removed as well.

I will do that with my next installment.

Ciao
Stephan

  parent reply	other threads:[~2015-01-20  3:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 15:51 [PATCH v8 0/2] crypto: AF_ALG: add AEAD and RNG support Stephan Mueller
2015-01-07 15:51 ` [PATCH v8 1/2] crypto: AF_ALG: add AEAD support Stephan Mueller
     [not found]   ` <6260799.4x68Msg3Li-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2015-01-08 11:09     ` Herbert Xu
     [not found]       ` <20150108110931.GA8568-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2015-01-09  3:30         ` Stephan Mueller
     [not found]           ` <1639027.yRSjDuRfFC-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2015-01-20  3:00             ` Herbert Xu
     [not found]               ` <20150120030017.GA10475-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2015-01-20  3:08                 ` Stephan Mueller [this message]
     [not found] ` <33040723.pAXIT3fl8h-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2015-01-07 15:52   ` [PATCH v8 2/2] crypto: AF_ALG: enable AEAD interface compilation Stephan Mueller

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=2322046.U2aPs8NjYq@tauon \
    --to=smueller-t9tcv8ipfcwelga04laivw@public.gmane.org \
    --cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=quentin.gouchet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).