From: John Fastabend <john.fastabend@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
cong.wang@bytedance.com, jakub@cloudflare.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, andrii@kernel.org,
eddyz87@gmail.com, mykolal@fb.com, ast@kernel.org,
daniel@iogearbox.net, martin.lau@linux.dev, song@kernel.org,
yonghong.song@linux.dev, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, shuah@kernel.org,
mhal@rbox.co, sgarzare@redhat.com, netdev@vger.kernel.org,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, mrpre@163.com,
syzbot+dd90a702f518e0eac072@syzkaller.appspotmail.com
Subject: Re: [PATCH bpf-next v1 1/3] bpf, sockmap: avoid using sk_socket after free
Date: Thu, 27 Feb 2025 12:57:15 -0800 [thread overview]
Message-ID: <20250227205641.n2zpm5yetkoopvcz@gmail.com> (raw)
In-Reply-To: <Z8DA8TqMEYNziiT9@pop-os.localdomain>
On 2025-02-27 11:45:53, Cong Wang wrote:
> On Wed, Feb 26, 2025 at 09:22:40PM +0800, Jiayuan Chen wrote:
> > Use RCU lock to protect sk_socket, preventing concurrent close and release
> > by another thread.
> >
> > Because TCP/UDP are already within a relatively large critical section:
> > '''
> > ip_local_deliver_finish
> > rcu_read_lock
> > ip_protocol_deliver_rcu
> > tcp_rcv/udp_rcv
> > rcu_read_unlock
> > '''
> >
> > Adding rcu_read_{un}lock() at the entrance and exit of sk_data_ready
> > will not increase performance overhead.
> >
> > Reported-by: syzbot+dd90a702f518e0eac072@syzkaller.appspotmail.com
> > Closes: https://lore.kernel.org/bpf/6734c033.050a0220.2a2fcc.0015.GAE@google.com/
> > Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
>
> sock_def_readable() already acquires RCU read lock anyway.
>
> Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Thanks.
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
next prev parent reply other threads:[~2025-02-27 20:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 13:22 [PATCH bpf-next v1 0/3] bpf: Fix use-after-free of sockmap Jiayuan Chen
2025-02-26 13:22 ` [PATCH bpf-next v1 1/3] bpf, sockmap: avoid using sk_socket after free Jiayuan Chen
2025-02-27 19:45 ` Cong Wang
2025-02-27 20:57 ` John Fastabend [this message]
2025-02-27 23:04 ` Martin KaFai Lau
2025-02-28 4:49 ` Jiayuan Chen
2025-02-26 13:22 ` [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket Jiayuan Chen
2025-02-27 19:52 ` Cong Wang
2025-02-27 22:21 ` John Fastabend
2025-02-28 4:51 ` Jiayuan Chen
2025-02-28 4:51 ` Jiayuan Chen
2025-02-26 13:22 ` [PATCH bpf-next v1 3/3] selftests/bpf: Add edge case tests for sockmap Jiayuan Chen
2025-02-27 19:53 ` Cong Wang
2025-02-27 22:18 ` John Fastabend
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=20250227205641.n2zpm5yetkoopvcz@gmail.com \
--to=john.fastabend@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=horms@kernel.org \
--cc=jakub@cloudflare.com \
--cc=jiayuan.chen@linux.dev \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mhal@rbox.co \
--cc=mrpre@163.com \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=sgarzare@redhat.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=syzbot+dd90a702f518e0eac072@syzkaller.appspotmail.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yonghong.song@linux.dev \
/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