diff options
author | Jörn-Thorben Hinz <[email protected]> | 2022-06-21 09:01:16 +0200 |
---|---|---|
committer | Andrii Nakryiko <[email protected]> | 2022-06-23 10:52:12 -0700 |
commit | 6dc7a0baf1a70b7d22662d38481824c14ddd80c5 (patch) | |
tree | 3123f27ae175a2c74e738e38873cb5d736c78c1e /tools/perf/scripts/python | |
parent | bb7a4257892717caf82fe6da45b259b35f73445c (diff) |
selftests/bpf: Fix rare segfault in sock_fields prog test
test_sock_fields__detach() got called with a null pointer here when one
of the CHECKs or ASSERTs up to the test_sock_fields__open_and_load()
call resulted in a jump to the "done" label.
A skeletons *__detach() is not safe to call with a null pointer, though.
This led to a segfault.
Go the easy route and only call test_sock_fields__destroy() which is
null-pointer safe and includes detaching.
Came across this while looking[1] to introduce the usage of
bpf_tcp_helpers.h (included in progs/test_sock_fields.c) together with
vmlinux.h.
[1] https://lore.kernel.org/bpf/629bc069dd807d7ac646f836e9dca28bbc1108e2.camel@mailbox.tu-berlin.de/
Fixes: 8f50f16ff39d ("selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads")
Signed-off-by: Jörn-Thorben Hinz <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Jakub Sitnicki <[email protected]>
Reviewed-by: Martin KaFai Lau <[email protected]>
Acked-by: John Fastabend <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions