Re: [PATCH v3 5/5] selftests/ftrace: Update fprobe test to check enabled_functions file

From: Heiko Carstens
Date: Wed Feb 26 2025 - 08:57:53 EST


On Wed, Feb 26, 2025 at 08:47:59AM -0500, Steven Rostedt wrote:
> On Wed, 26 Feb 2025 11:50:28 +0100
> Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
> > # cat tracing/enabled_functions
> > free_user_ns (1) R
> > bpf_lsm_path_mkdir (1) R D M tramp: ftrace_regs_caller+0x0/0x68 (call_direct_funcs+0x0/0x20)
> > direct-->bpf_trampoline_6442505669+0x0/0x148
> > bpf_lsm_path_mknod (1) R D M tramp: ftrace_regs_caller+0x0/0x68 (call_direct_funcs+0x0/0x20)
> > direct-->bpf_trampoline_6442505671+0x0/0x14e
>
> After I submitted the patches, I then remembered that some user space tools
> add BPF programs that attach to functions, and those will show up in the
> enabled_functions table (that's a feature as it is always good to know what
> is modifying your kernel!). And I figured it will break this test.
>
> I decided to wait until someone complains about it before fixing it ;-)
...
> >
> > This could be worked around for example with something like the patch
> > below (against linux-next). But no idea what your preferred way to
> > handle this would be.
>
> Actually, when I thought about fixing this, your patch is pretty much what
> I was thinking of doing.

Ok, I'll send a proper patch then.