All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org, davejwatson@fb.com, kuba@kernel.org,
	vakul.garg@nxp.com, borisp@nvidia.com, john.fastabend@gmail.com
Subject: Re: [PATCH net 1/5] net: tls: handle -EBUSY on async encrypt/decrypt requests
Date: Tue, 12 Sep 2023 17:37:23 +0200	[thread overview]
Message-ID: <ZQCFs61yeFlYsHVX@hog> (raw)
In-Reply-To: <ZP/sdGHy7LVE3UEc@gondor.apana.org.au>

2023-09-12, 12:43:32 +0800, Herbert Xu wrote:
> On Fri, Sep 08, 2023 at 05:55:59PM +0200, Sabrina Dubroca wrote:
> >
> > Uh, ok, I didn't know that, thanks for explaining. When I was fixing
> > this code I couldn't find a mention of what the expectations for
> > MAY_BACKLOG are. Could you add a comment describing this in the
> > headers (either for #define CRYPTO_TFM_REQ_MAY_BACKLOG or
> > aead_request_set_callback, wherever is more appropriate). MAY_BACKLOG
> > is used by both tls and tipc (talking only about networking) and
> > neither seem to respect this need to back off.
> 
> Patches are welcome :)

Ok. I thought it'd be better if you wrote that patch since if I write
it, it'll be a c/p (or rephrase) of what you wrote. But fine, I'll go
ahead and do that :)

> A bit of history: at the beginning we always dropped requests
> that we couldn't queue because the only user was IPsec so this
> is the expected behaviour.
> 
> When storage crypto support was added there was a need for reliable
> handling of resource constraints so that's why MAY_BACKLOG was added.
> However, the expectation is obviously that you must stop sending new
> requests once you run into the resource constraint.
> 
> > Jakub, I guess we should drop the CRYPTO_TFM_REQ_MAY_BACKLOG for net,
> > and maybe consider adding it back (with the back off) in
> > net-next. Probably not urgent considering that nobody seems to have
> > run into this bug so far.
> 
> I think that would be the prudent action.

We'd have to do pretty much what Jakub suggested [1] (handle ENOSPC by
waiting for all current requests) and then resubmit the failed
request. So I think keeping the MAY_BACKLOG flag and handling EBUSY
this way is simpler. With this, we send one request to the backlog,
then we wait until the queue drains.

[1] https://lore.kernel.org/netdev/20230908142602.2ced0631@kernel.org/

-- 
Sabrina


  reply	other threads:[~2023-09-12 15:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 17:08 [PATCH net 0/5] tls: fix some issues with async encryption Sabrina Dubroca
2023-09-06 17:08 ` [PATCH net 1/5] net: tls: handle -EBUSY on async encrypt/decrypt requests Sabrina Dubroca
2023-09-07  1:50   ` Jakub Kicinski
2023-09-07 15:11   ` Simon Horman
2023-09-08  6:10   ` Herbert Xu
2023-09-08 15:55     ` Sabrina Dubroca
2023-09-08 21:26       ` Jakub Kicinski
2023-09-09  0:53         ` Herbert Xu
2023-09-12  4:43       ` Herbert Xu
2023-09-12 15:37         ` Sabrina Dubroca [this message]
2023-09-14  9:00           ` Herbert Xu
2023-09-06 17:08 ` [PATCH net 2/5] tls: fix use-after-free with partial reads and async decrypt Sabrina Dubroca
2023-09-07  2:05   ` Jakub Kicinski
2023-09-07 13:56     ` Sabrina Dubroca
2023-09-06 17:08 ` [PATCH net 3/5] tls: fix returned read length with async !zc decrypt Sabrina Dubroca
2023-09-06 17:08 ` [PATCH net 4/5] tls: fix race condition in async decryption of corrupted records Sabrina Dubroca
2023-09-06 17:08 ` [PATCH net 5/5] tls: don't decrypt the next record if it's of a different type Sabrina Dubroca
2023-09-07  3:47   ` Jakub Kicinski
2023-09-07 12:21     ` Sabrina Dubroca
2023-09-07 17:08       ` Jakub Kicinski
2023-09-08  6:06       ` Herbert Xu
2023-09-08 15:38         ` Sabrina Dubroca
2023-09-12  4:38           ` Herbert Xu
2023-09-13 13:25             ` Sabrina Dubroca
2023-09-14  9:45               ` Herbert Xu

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=ZQCFs61yeFlYsHVX@hog \
    --to=sd@queasysnail.net \
    --cc=borisp@nvidia.com \
    --cc=davejwatson@fb.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vakul.garg@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.