[PATCH bpf-next 2/2] selftests/bpf: Remove filter for unsafe functions in kprobe_multi test

Jiri Olsa
2022-05-15T20:37:28Z

Removing filter for arch_cpu_idle and rcu_* functions.

Attaching to them was causing RCU warnings [1]:

[ 3.017540] WARNING: suspicious RCU usage
...
[ 3.018363] kprobe_multi_link_handler+0x68/0x1c0
[ 3.018364] ? kprobe_multi_link_handler+0x3e/0x1c0
[ 3.018366] ? arch_cpu_idle_dead+0x10/0x10
[ 3.018367] ? arch_cpu_idle_dead+0x10/0x10
[ 3.018371] fprobe_handler.part.0+0xab/0x150
[ 3.018374] 0xffffffffa00080c8
[ 3.018393] ? arch_cpu_idle+0x5/0x10
[ 3.018398] arch_cpu_idle+0x5/0x10
[ 3.018399] default_idle_call+0x59/0x90
[ 3.018401] do_idle+0x1c3/0x1d0

With previous fix the functions causing that are no longer attachable.

[1] https://lore.kernel.org/bpf/CAEf4BzYtXWvBWzmadhLGqwf8_e2sruK6999th6c=b=O0WLkHOA@mail.gmail.com/
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
.../selftests/bpf/prog_tests/kprobe_multi_test.c | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
index 586dc52d6fb9..8bb974c263c3 100644
--- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
@@ -354,16 +354,6 @@ static int get_syms(char ***symsp, size_t *cntp)
continue;
if (sscanf(buf, "%ms$*[^\n]\n", &name) != 1)
continue;
- /*
- * We attach to almost all kernel functions and some of them
- * will cause 'suspicious RCU usage' when fprobe is attached
- * to them. Filter out the current culprits - arch_cpu_idle
- * and rcu_* functions.
- */
- if (!strcmp(name, "arch_cpu_idle"))
- continue;
- if (!strncmp(name, "rcu_", 4))
- continue;
err = hashmap__add(map, name, NULL);
if (err) {
free(name);
--
2.35.3