From: Paolo Abeni <pabeni@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com,
andrew+netdev@lunn.ch, horms@kernel.org, sd@queasysnail.net,
john.fastabend@gmail.com, bpf@vger.kernel.org
Subject: Re: [PATCH net v2 4/4] net: tls: remove bad rollback and UAF on ENOSPC
Date: Thu, 14 May 2026 13:18:12 +0200 [thread overview]
Message-ID: <a83d79d1-b932-458a-b5fa-1cb623fa03f1@redhat.com> (raw)
In-Reply-To: <20260511174920.433155-5-kuba@kernel.org>
On 5/11/26 7:49 PM, Jakub Kicinski wrote:
> As explained in commit 54a3ecaeeeae ("bpf: fix ktls panic with sockmap")
> once we call BPF there's no way for us to rollback the iter
> and copy data, since BPF may have modified the message.
> This is regardless of whether BPF set up cork or not.
>
> Remove the attempt to roll back iter completely. This removes a UAF
> since BPF may have modified msg_pl and rec, so these pointers were
> stale.
>
> Note that I'm entirely unsure what the expected behavior is here
> for BPF. Feels like this path must not be exercised by normal
> applications / existing deployments in the first place.
>
> Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> net/tls/tls_sw.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
> index 360f71fd7884..22b77840e35a 100644
> --- a/net/tls/tls_sw.c
> +++ b/net/tls/tls_sw.c
> @@ -1164,11 +1164,8 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,
> else if (ret == -ENOMEM)
> goto wait_for_memory;
> else if (ctx->open_rec && ret == -ENOSPC) {
> - if (msg_pl->cork_bytes) {
> - ret = 0;
> - goto send_end;
> - }
> - goto rollback_iter;
> + ret = 0;
> + goto send_end;
The sashiko report here looks like a pre-existing issue that could be
handled separately.
Still let me play safe and merge just the 2 first patch in the series.
In case of a repost, please fix the typo (repetition) in the cover
letter subj.
/P
next prev parent reply other threads:[~2026-05-14 11:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 17:49 [PATCH net v2 0/4] net: tls: net: tls: fix a few random bugs Jakub Kicinski
2026-05-11 17:49 ` [PATCH net v2 1/4] net: tls: fix off-by-one in sg_chain entry count for wrapped sk_msg ring Jakub Kicinski
2026-05-12 10:21 ` Sabrina Dubroca
2026-05-11 17:49 ` [PATCH net v2 2/4] net: tls: prevent chain-after-chain in plain text SG Jakub Kicinski
2026-05-12 11:09 ` Sabrina Dubroca
2026-05-12 16:03 ` Jakub Kicinski
2026-05-12 22:30 ` Sabrina Dubroca
2026-05-13 0:14 ` Jakub Kicinski
2026-05-11 17:49 ` [PATCH net v2 3/4] net: tls: fix use-after-free in tls_sw_sendmsg_locked after bpf verdict Jakub Kicinski
2026-05-12 9:47 ` Jiayuan Chen
2026-05-12 16:04 ` Jakub Kicinski
2026-05-11 17:49 ` [PATCH net v2 4/4] net: tls: remove bad rollback and UAF on ENOSPC Jakub Kicinski
2026-05-14 11:18 ` Paolo Abeni [this message]
2026-05-14 12:55 ` Sabrina Dubroca
2026-05-14 14:55 ` Jakub Kicinski
2026-05-14 15:05 ` Sabrina Dubroca
2026-05-14 15:09 ` Jakub Kicinski
2026-05-12 9:28 ` [PATCH net v2 0/4] net: tls: net: tls: fix a few random bugs Jakub Sitnicki
2026-05-12 9:37 ` Sabrina Dubroca
2026-05-14 11:30 ` patchwork-bot+netdevbpf
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=a83d79d1-b932-458a-b5fa-1cb623fa03f1@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
/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