Re: [PATCH bpf v2 0/4] bpf, sockmap: Fix sockmap leaking UDP socks
From: sun jian <hidden>
Date: 2026-06-27 17:35:00
Also in:
bpf, linux-kselftest, lkml
On Sat, Jun 27, 2026 at 4:37 AM Michal Luczaj [off-list ref] wrote:
Fix for UDP sockets getting leaked during sockmap lookup/release. Accompanied by selftests updates. Signed-off-by: Michal Luczaj <redacted> --- Changes in v2: - selftest: drop the original, adapt old tests - fix: change approach to rejecting unbound UDP [Kuniyuki] - Link to v1: https://patch.msgid.link/20260623-sockmap-lookup-udp-leak-v1-0-05804f9308e4@rbox.co --- Michal Luczaj (4): bpf, sockmap: Reject unhashed UDP sockets on sockmap update selftests/bpf: Ensure UDP sockets are bound selftests/bpf: Adapt sockmap update error handling selftests/bpf: Fail unbound UDP on sockmap update net/core/sock_map.c | 2 ++ tools/testing/selftests/bpf/prog_tests/sockmap_basic.c | 6 +++--- tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 17 +++++++++-------- tools/testing/selftests/bpf/test_maps.c | 6 +++--- 4 files changed, 17 insertions(+), 14 deletions(-) --- base-commit: 26490a375cb9be9bac96b5171610fd85ca6c2305 change-id: 20260617-sockmap-lookup-udp-leak-bc4e5c5481d7 Best regards, -- Michal Luczaj [off-list ref]
Hi Michal,
I tested this series on bpf.git base commit:
26490a375cb9be9bac96b5171610fd85ca6c2305
The test environment was virtme-ng x86_64.
Before, with only patches 2/4-4/4 applied:
sockmap_basic: PASS
sockmap_listen: FAIL as expected
- UDP test_insert_opened failed on sockmap/sockhash,
both IPv4 and IPv6
test_maps: FAIL as expected
- failed at the new unbound SOCK_DGRAM update check
After applying the full series:
sockmap_basic: PASS
sockmap_listen: PASS
test_maps: no longer failed at the unbound
SOCK_DGRAM update check
test_maps still later reported:
Failed sockmap unexpected timeout
However, I can reproduce the same timeout in three consecutive
runs on the unmodified base commit, so this looks pre-existing or
environmental in my virtme-ng setup rather than a regression from
this series.
I am not adding a Tested-by tag for now because test_maps does not
fully pass in my setup. The targeted before/after behavior behaved as
expected.
Thanks,
Sun Jian