From: Jakub Kicinski <kuba@kernel.org>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
netdev@vger.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: Fri, 8 Sep 2023 14:26:02 -0700 [thread overview]
Message-ID: <20230908142602.2ced0631@kernel.org> (raw)
In-Reply-To: <ZPtED-ZlSEQmPSlr@hog>
On Fri, 8 Sep 2023 17:55:59 +0200 Sabrina Dubroca wrote:
> 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.
Someone did mention it long time ago, but I don't recall the context :S
I think it was something about the device queue filling up..
> But then we have to handle ENOSPC a bit more gracefully, because right
> now it looks like
> - on TX, we break the socket (tls_err_abort when tls_do_encryption returns
> an error)
> - on RX, we also break the socket, and we don't decrement
> decrypt_pending so the recv() call gets stuck
>
> Not sure how complex the changes would be, the sendmsg and recvmsg
> code is already a bit hard to follow.
To keep it simple we can wait for all in-flight requests to drain if we
hit EBUSY? Basically factor this bit out:
spin_lock_bh(&ctx->decrypt_compl_lock);
reinit_completion(&ctx->async_wait.completion);
pending = atomic_read(&ctx->decrypt_pending);
spin_unlock_bh(&ctx->decrypt_compl_lock);
ret = 0;
if (pending)
ret = crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
and call it after we get EBUSY? We'll drain the pending queue all the
way to empty, which may not be too great for throughput, but who cares
- right now we don't handle EBUSY at all, so it must be extremely rare.
next prev parent reply other threads:[~2023-09-08 21:26 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 [this message]
2023-09-09 0:53 ` Herbert Xu
2023-09-12 4:43 ` Herbert Xu
2023-09-12 15:37 ` Sabrina Dubroca
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=20230908142602.2ced0631@kernel.org \
--to=kuba@kernel.org \
--cc=borisp@nvidia.com \
--cc=herbert@gondor.apana.org.au \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
--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 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).