Re: [RFC PATCH bpf-next 2/2] selftests/livepatch: update test-ftrace.sh for deprecated ftrace_enabled

Miroslav Benes <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.bpf,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-trace-kernel,org.kernel.vger.live-patching,org.kernel.vger.stable
Message-ID <[email protected]>
On Thu, 30 Jul 2026, Steven Rostedt wrote:

> On Thu, 30 Jul 2026 12:35:44 -0400
> Andrey Grodzovsky <[email protected]> wrote:
> 
> > kernel.ftrace_enabled=0 is now always refused, so the old scenario
> > (disable, fail to load a livepatch, re-enable, load) no longer applies.
> > Replace it with a single check that the write is refused with the new
> > error, and drop the now-stale disable/reload flow.
> > 
> > Assisted-by: Claude:claude-sonnet-5
> > Signed-off-by: Andrey Grodzovsky <[email protected]>
> > ---
> >  .../selftests/livepatch/test-ftrace.sh        | 49 ++-----------------
> >  1 file changed, 3 insertions(+), 46 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/livepatch/test-ftrace.sh b/tools/testing/selftests/livepatch/test-ftrace.sh
> > index d2c3dea63104..c88f4d13a134 100755
> > --- a/tools/testing/selftests/livepatch/test-ftrace.sh
> > +++ b/tools/testing/selftests/livepatch/test-ftrace.sh
> > @@ -9,56 +9,13 @@ MOD_LIVEPATCH=test_klp_livepatch
> >  setup_config
> >  
> >  
> > -# - turn ftrace_enabled OFF and verify livepatches can't load
> > -# - turn ftrace_enabled ON and verify livepatch can load
> > -# - verify that ftrace_enabled can't be turned OFF while a livepatch is loaded
> > +# - verify that kernel.ftrace_enabled=0 is refused (deprecated knob)
> >  
> > -start_test "livepatch interaction with ftrace_enabled sysctl"
> > +start_test "ftrace_enabled sysctl write is refused (deprecated)"
> >  
> > -set_ftrace_enabled 0
> > -load_failing_mod $MOD_LIVEPATCH
> > -
> > -set_ftrace_enabled 1
> > -load_lp $MOD_LIVEPATCH
> > -if [[ "$(cat /proc/cmdline)" != "$MOD_LIVEPATCH: this has been live patched" ]] ; then
> > -	echo -e "FAIL\n\n"
> > -	die "livepatch kselftest(s) failed"
> > -fi
> > -
> 
> This test should work for both old and new kernels. I would have it still
> do everything here but if setting ftrace_enabled returns -EOPNOTSUPP then
> do the simple path.

Yes, please. It would be ideal.

Miroslav
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.