diff options
| author | Tengda Wu <[email protected]> | 2025-01-22 02:28:38 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2025-02-03 11:33:51 +0000 |
| commit | a63a631c9b5cb25a1c17dd2cb18c63df91e978b1 (patch) | |
| tree | 9e5906fa173a2f9a11e338fc7310a00cc09dbf8c /tools/lib/bpf/btf.c | |
| parent | Linux 6.14-rc1 (diff) | |
| download | kernel-a63a631c9b5cb25a1c17dd2cb18c63df91e978b1.tar.gz kernel-a63a631c9b5cb25a1c17dd2cb18c63df91e978b1.zip | |
selftests/bpf: Fix freplace_link segfault in tailcalls prog test
There are two bpf_link__destroy(freplace_link) calls in
test_tailcall_bpf2bpf_freplace(). After the first bpf_link__destroy()
is called, if the following bpf_map_{update,delete}_elem() throws an
exception, it will jump to the "out" label and call bpf_link__destroy()
again, causing double free and eventually leading to a segfault.
Fix it by directly resetting freplace_link to NULL after the first
bpf_link__destroy() call.
Fixes: 021611d33e78 ("selftests/bpf: Add test to verify tailcall and freplace restrictions")
Signed-off-by: Tengda Wu <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Leon Hwang <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/lib/bpf/btf.c')
0 files changed, 0 insertions, 0 deletions
