Thread (14 messages) flat view 14 messages, 4 authors, 2025-02-28

Re: [PATCH bpf-next v1 1/3] bpf, sockmap: avoid using sk_socket after free

From: Jiayuan Chen <jiayuan.chen@linux.dev>
Date: 2025-02-28 04:50:08
Also in: bpf, linux-kselftest, lkml

On Thu, Feb 27, 2025 at 03:04:26PM -0800, Martin KaFai Lau wrote:
On 2/26/25 5:22 AM, Jiayuan Chen wrote:
quoted
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.
Can it use a Fixes tag?
Thanks, Martin.
It seems that this issue has existed since sockmap supported unix.
I'll find the corresponding commit as the Fixes tag.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help