On Thu, Aug 6, 2026 at 5:18 PM Song Liu <[email protected]> wrote: > > On Thu, Aug 6, 2026 at 8:30 AM Andrey Grodzovsky > <[email protected]> wrote: > > > > kernel.ftrace_enabled=0 is now refused on kernels that deprecate the > > knob, so the old disable/reload flow no longer applies there. Probe > > for this with ftrace_disable_supported() and keep the full original > > scenario (disable, fail to load a livepatch, re-enable, load, confirm > > disable is refused while loaded) on kernels where it still works; > > otherwise just confirm the write is refused. > > > > Suggested-by: Steven Rostedt <[email protected]> > > Suggested-by: Joe Lawrence <[email protected]> > > Assisted-by: Claude:claude-sonnet-5 > > Signed-off-by: Andrey Grodzovsky <[email protected]> > > --- > > > > .../testing/selftests/livepatch/https://urldefense.com/v3/__http://functions.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj2qtEXgW$ > > | 14 ++++++ > > > > .../selftests/livepatch/https://urldefense.com/v3/__http://test-ftrace.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj6oTNhr1$ > > | 45 ++++++++++++------- > > 2 files changed, 42 insertions(+), 17 deletions(-) > > > > diff --git > > a/tools/testing/selftests/livepatch/https://urldefense.com/v3/__http://functions.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj2qtEXgW$ > > > > b/tools/testing/selftests/livepatch/https://urldefense.com/v3/__http://functions.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj2qtEXgW$ > > index 30dc677b2f45..a65b7b1ac8ad 100644 > > --- > > a/tools/testing/selftests/livepatch/https://urldefense.com/v3/__http://functions.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj2qtEXgW$ > > +++ > > b/tools/testing/selftests/livepatch/https://urldefense.com/v3/__http://functions.sh__;!!BmdzS3_lV9HdKG8!0iHqKyQrLfspbt4sQvekjrQjWLuiSTtsCXR9obFozOCSUhPg1KCQGTvfgZ9oTwgBkdB3nKZA1RCYtwwYj2qtEXgW$ > > @@ -126,6 +126,20 @@ function set_ftrace_enabled() { > > echo "livepatch: kernel.ftrace_enabled = $result" > /dev/kmsg > > } > > > > +# ftrace_disable_supported() - probe whether kernel.ftrace_enabled=0 > > +# can still disable ftrace on this kernel. Newer kernels deprecate > > +# the knob and always refuse the write with -EOPNOTSUPP. > > +function ftrace_disable_supported() { > > + local orig result > > + > > + orig=$(sysctl --values kernel.ftrace_enabled) > > + sysctl -q kernel.ftrace_enabled=0 &> /dev/null > > + result=$(sysctl --values kernel.ftrace_enabled) > > + sysctl -q "kernel.ftrace_enabled=$orig" &> /dev/null > > + > > + [[ "$result" == "0" ]] > > +} > > Since the selftests are shipped with the kernel code, I think > we don't need to handle backward compatibility here. Instead, > we can just assume disabling ftrace is no longer supported. > > Thanks, > Song
I tend to agree but I think here[1] Steve and Miroslav asked for backward compatability. V1 was actually the way you prefer. Andrey [1] - https://lore.kernel.org/bpf/[email protected]/ > > [...]
