diff options
author | 2022-07-29 12:41:06 -0700 | |
---|---|---|
committer | 2022-07-29 14:20:29 -0700 | |
commit | dc81f8d1e8ea3f5dfa88919cb834a135a6a536b8 (patch) | |
tree | 768396ce424885c8a66b3fadb7b348195b236199 /tools/lib/bpf/libbpf.map | |
parent | selftests/bpf: Bump internal send_signal/send_signal_tracepoint timeout (diff) | |
download | linux-dev-dc81f8d1e8ea3f5dfa88919cb834a135a6a536b8.tar.xz linux-dev-dc81f8d1e8ea3f5dfa88919cb834a135a6a536b8.zip |
bpf: Fix test_progs -j error with fentry/fexit tests
When multiple threads are attaching/detaching fentry/fexit programs to
the same trampoline, we may call register_fentry on the same trampoline
twice: register_fentry(), unregister_fentry(), then register_fentry again.
This causes ftrace_set_filter_ip() for the same ip on tr->fops twice,
which leaves duplicated ip in tr->fops. The extra ip is not cleaned up
properly on unregister and thus causes failures with further register in
register_ftrace_direct_multi():
register_ftrace_direct_multi()
{
...
for (i = 0; i < size; i++) {
hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
if (ftrace_find_rec_direct(entry->ip))
goto out_unlock;
}
}
...
}
This can be triggered with parallel fentry/fexit tests with test_progs:
./test_progs -t fentry,fexit -j
Fix this by resetting tr->fops in ftrace_set_filter_ip(), so that there
will never be duplicated entries in tr->fops.
Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220729194106.1207472-1-song@kernel.org
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions