diff options
| author | Jiayuan Chen <jiayuan.chen@linux.dev> | 2026-09-10 19:28:02 +0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-10 16:58:40 -0700 |
| commit | 8036d3a5a6589ef0721d15e7c03976bc3996f7a8 (patch) | |
| tree | b1630d699b422154bf52ef64e086180b2dfb41e7 /tools/perf/scripts/python | |
| parent | eaab8cab451b9502ce224cd202550375b894a467 (diff) | |
| download | linux-next-8036d3a5a6589ef0721d15e7c03976bc3996f7a8.tar.gz linux-next-8036d3a5a6589ef0721d15e7c03976bc3996f7a8.zip | |
selftests/bpf: Test bpf_sock_destroy() on TIME_WAIT and listener socks
Add two subtests.
tcp_timewait: the client shuts down first and the server closes after
it, so the client sock ends up in TIME_WAIT. A tcp iterator then finds
the timewait sock by the cookie it inherited from the client sock and
destroys it. Iterate once more to make sure it is gone. Without the
first fix bpf_sock_destroy() reads past the timewait sock and KASAN
complains.
tcp_listen_pending: connect to a listener but never accept, so the child
sits in the accept queue, then destroy the listener. Without the second
fix the cond_resched() in inet_csk_listen_stop() trips the might_sleep
check under rcu_read_lock().
./test_progs -a sock_destroy
#444/1 sock_destroy/tcp_client:OK
#444/2 sock_destroy/tcp_server:OK
#444/3 sock_destroy/tcp_listen_pending:OK
#444/4 sock_destroy/tcp_timewait:OK
#444/5 sock_destroy/udp_client:OK
#444/6 sock_destroy/udp_server:OK
#444/7 sock_destroy/trace_tcp_destroy_sock:OK
#444 sock_destroy:OK
Summary: 1/7 PASSED, 0 SKIPPED, 0/0 FAILED
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://lore.kernel.org/r/20260910112810.153801-1-jiayuan.chen@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
