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
-
-# Check that ftrace could not get disabled when a livepatch is enabled
 set_ftrace_enabled --fail 0
-if [[ "$(cat /proc/cmdline)" != "$MOD_LIVEPATCH: this has been live patched" 
]] ; then
-       echo -e "FAIL\n\n"
-       die "livepatch kselftest(s) failed"
-fi
-disable_lp $MOD_LIVEPATCH
-unload_lp $MOD_LIVEPATCH
 
-check_result "livepatch: kernel.ftrace_enabled = 0
-% insmod test_modules/$MOD_LIVEPATCH.ko
-livepatch: enabling patch '$MOD_LIVEPATCH'
-livepatch: '$MOD_LIVEPATCH': initializing patching transition
-livepatch: failed to register ftrace handler for function 'cmdline_proc_show' 
(-16)
-livepatch: failed to patch object 'vmlinux'
-livepatch: failed to enable patch '$MOD_LIVEPATCH'
-livepatch: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch
-livepatch: '$MOD_LIVEPATCH': completing unpatching transition
-livepatch: '$MOD_LIVEPATCH': unpatching complete
-insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Device 
or resource busy
-livepatch: kernel.ftrace_enabled = 1
-% insmod test_modules/$MOD_LIVEPATCH.ko
-livepatch: enabling patch '$MOD_LIVEPATCH'
-livepatch: '$MOD_LIVEPATCH': initializing patching transition
-livepatch: '$MOD_LIVEPATCH': starting patching transition
-livepatch: '$MOD_LIVEPATCH': completing patching transition
-livepatch: '$MOD_LIVEPATCH': patching complete
-livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource 
busy
-% echo 0 > $SYSFS_KLP_DIR/$MOD_LIVEPATCH/enabled
-livepatch: '$MOD_LIVEPATCH': initializing unpatching transition
-livepatch: '$MOD_LIVEPATCH': starting unpatching transition
-livepatch: '$MOD_LIVEPATCH': completing unpatching transition
-livepatch: '$MOD_LIVEPATCH': unpatching complete
-% rmmod $MOD_LIVEPATCH"
+check_result "livepatch: sysctl: setting key \"kernel.ftrace_enabled\": 
Operation not supported"
 
 
 # - verify livepatch can load
-- 
2.34.1


Reply via email to