From: Matthieu Baerts <matttbe@kernel.org>
To: "Cen Zhang (Microsoft)" <blbllhy@gmail.com>,
edumazet@google.com, ncardwell@google.com, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com
Cc: kuniyu@google.com, horms@kernel.org, martineau@kernel.org,
geliang@kernel.org, yhs@fb.com, kafai@fb.com, andriin@fb.com,
ast@kernel.org, netdev@vger.kernel.org, mptcp@lists.linux.dev,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
AutonomousCodeSecurity@microsoft.com, xmei5@asu.edu,
tgopinath@linux.microsoft.com, kys@microsoft.com,
stable@vger.kernel.org
Subject: Re: [PATCH net v3 1/2] tcp: fix use-after-free in do_tcp_getsockopt(TCP_CONGESTION)
Date: Fri, 28 Aug 2026 11:41:49 +0200 [thread overview]
Message-ID: <d5eac10c-48f1-4c09-b871-b946c6417399@kernel.org> (raw)
In-Reply-To: <d3f97f1acbf0010898148be6e6406e4b8b4a5c84.1787870710.git.blbllhy@gmail.com>
On 28/08/2026 01:55, Cen Zhang (Microsoft) wrote:
> From: "Cen Zhang (Microsoft Security FORGE Labs)" <blbllhy@gmail.com>
>
> do_tcp_getsockopt() reads icsk->icsk_ca_ops->name without holding
> rcu_read_lock(). Since commit 0baf26b0fcd7 ("bpf: tcp: Support
> tcp_congestion_ops in bpf"), icsk_ca_ops can point to dynamically
> allocated BPF struct_ops memory that may be freed concurrently via
> setsockopt(TCP_CONGESTION), leading to a use-after-free.
>
> BUG: KASAN: slab-use-after-free in _copy_to_user+0x37/0x60
> Read of size 16 at addr ffff888013505260 by task exploit/149
> _copy_to_user+0x37/0x60
> do_tcp_getsockopt+0x158a/0x2460 (net/ipv4/tcp.c:4585)
> tcp_getsockopt+0x91/0xf0
> __sys_getsockopt+0xf7/0x170
>
> Fix this by holding rcu_read_lock() around the ca_ops->name access,
> using READ_ONCE() to load icsk_ca_ops, and copying the name to a
> stack buffer before releasing the lock. Also annotate the relevant
> icsk_ca_ops stores with WRITE_ONCE() to fix the accompanying KCSAN
> data-race issue.
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2026-08-28 9:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 23:55 [PATCH net v3 0/2] tcp: fix use-after-free in do_tcp_getsockopt() Cen Zhang (Microsoft)
2026-08-27 23:55 ` [PATCH net v3 1/2] tcp: fix use-after-free in do_tcp_getsockopt(TCP_CONGESTION) Cen Zhang (Microsoft)
2026-08-28 3:26 ` Jiayuan Chen
2026-08-28 9:41 ` Matthieu Baerts [this message]
2026-08-28 12:38 ` Breno Leitao
2026-08-28 13:02 ` Cen Zhang (Microsoft)
2026-08-28 14:17 ` Breno Leitao
2026-08-27 23:55 ` [PATCH net v3 2/2] tcp: fix use-after-free in do_tcp_getsockopt(TCP_CC_INFO) Cen Zhang (Microsoft)
2026-08-28 3:14 ` Jiayuan Chen
2026-08-28 9:42 ` Matthieu Baerts
2026-08-28 1:05 ` [PATCH net v3 0/2] tcp: fix use-after-free in do_tcp_getsockopt() MPTCP CI
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=d5eac10c-48f1-4c09-b871-b946c6417399@kernel.org \
--to=matttbe@kernel.org \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=blbllhy@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tgopinath@linux.microsoft.com \
--cc=xmei5@asu.edu \
--cc=yhs@fb.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.