Re: [RFC PATCH bpf-next 3/3] selftests/bpf: add ftrace_permanent test
flat view
From: Andrey Grodzovsky <hidden>
Date: 2026-07-29 17:16:15
Also in:
bpf, linux-kselftest, stable
On Wed, Jul 29, 2026 at 9:23 AM Jiri Olsa [off-list ref] wrote:
On Tue, Jul 28, 2026 at 08:59:59PM -0400, Andrey Grodzovsky wrote:quoted
Cover the FTRACE_OPS_FL_PERMANENT fix on BPF trampolines and ftrace-based kprobes/kretprobes: attach a fentry, fexit, kprobe, and kretprobe program in turn and confirm kernel.ftrace_enabled=0 is refused with EBUSY while attached, then succeeds once detached. Also confirm a new fentry/kprobe attach is itself refused while ftrace_enabled=0 is already in effect. kprobe.multi/kretprobe.multi/kprobe.session are intentionally not covered, matching the production change's scope. Skip the kprobe/kretprobe subtests when CONFIG_KPROBES_ON_FTRACE is off (e.g. arm64), read back via skel->kconfig->CONFIG_KPROBES_ON_FTRACE (same __kconfig idiom as progs/test_fill_link_info.c). Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Andrey Grodzovsky <redacted> ---hi, I have some links active already after boot which makes test to fail: [root@qemu-1 bpf]# echo 0 > /proc/sys/kernel/ftrace_enabled bash: echo: write error: Device or resource busy [root@qemu-1 bpf]# ./test_progs -t ftrace_permanent -v bpf_testmod.ko is already unloaded. Loading bpf_testmod.ko... Successfully loaded bpf_testmod.ko. test_ftrace_permanent:PASS:skel_open_and_load 0 nsec check_blocks_disable:PASS:attach_fentry 0 nsec check_blocks_disable:PASS:disable_refused 0 nsec check_blocks_disable:PASS:read_back 0 nsec check_blocks_disable:PASS:still_enabled 0 nsec check_blocks_disable:FAIL:disable_after_detach unexpected error: -16 (errno 16) check_blocks_disable:PASS:reenable 0 nsec #145/1 ftrace_permanent/fentry_blocks_disable:FAIL check_blocks_disable:PASS:attach_fexit 0 nsec check_blocks_disable:PASS:disable_refused 0 nsec check_blocks_disable:PASS:read_back 0 nsec check_blocks_disable:PASS:still_enabled 0 nsec check_blocks_disable:FAIL:disable_after_detach unexpected error: -16 (errno 16) check_blocks_disable:PASS:reenable 0 nsec #145/2 ftrace_permanent/fexit_blocks_disable:FAIL check_blocks_disable:PASS:attach_kprobe 0 nsec check_blocks_disable:PASS:disable_refused 0 nsec check_blocks_disable:PASS:read_back 0 nsec check_blocks_disable:PASS:still_enabled 0 nsec check_blocks_disable:FAIL:disable_after_detach unexpected error: -16 (errno 16) check_blocks_disable:PASS:reenable 0 nsec #145/3 ftrace_permanent/kprobe_blocks_disable:FAIL check_blocks_disable:PASS:attach_kretprobe 0 nsec check_blocks_disable:PASS:disable_refused 0 nsec check_blocks_disable:PASS:read_back 0 nsec check_blocks_disable:PASS:still_enabled 0 nsec check_blocks_disable:FAIL:disable_after_detach unexpected error: -16 (errno 16) check_blocks_disable:PASS:reenable 0 nsec #145/4 ftrace_permanent/kretprobe_blocks_disable:FAIL check_attach_while_disabled_refused:FAIL:disable unexpected error: -16 (errno 16) #145/5 ftrace_permanent/fentry_attach_while_disabled_refused:FAIL check_attach_while_disabled_refused:FAIL:disable unexpected error: -16 (errno 16) #145/6 ftrace_permanent/kprobe_attach_while_disabled_refused:FAIL #145 ftrace_permanent:FAIL Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED Successfully unloaded bpf_testmod.ko. jirka
Thank you, Jiri. I will address this once the decision on whether to proceed with this route or, just make ftrace_enabled obsolete, is made. Andrey