From: George Guo guodongtai@kylinos.cn
The script test-callbacks.sh fails with the following error: $ sudo ./test-callbacks.sh TEST: target module before livepatch ... not ok
- expected + result test_klp_callbacks_mod: test_klp_callbacks_mod_init % insmod test_modules/test_klp_callbacks_demo.ko livepatch: enabling patch 'test_klp_callbacks_demo' -livepatch: 'test_klp_callbacks_demo': initializing patching transition +transition: 'test_klp_callbacks_demo': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting patching transition -livepatch: 'test_klp_callbacks_demo': completing patching transition +transition: 'test_klp_callbacks_demo': starting patching transition +transition: 'test_klp_callbacks_demo': completing patching transition test_klp_callbacks_demo: post_patch_callback: vmlinux test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': patching complete +transition: 'test_klp_callbacks_demo': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled -livepatch: 'test_klp_callbacks_demo': initializing unpatching transition +transition: 'test_klp_callbacks_demo': initializing unpatching transition test_klp_callbacks_demo: pre_unpatch_callback: vmlinux test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting unpatching transition -livepatch: 'test_klp_callbacks_demo': completing unpatching transition +transition: 'test_klp_callbacks_demo': starting unpatching transition +transition: 'test_klp_callbacks_demo': completing unpatching transition test_klp_callbacks_demo: post_unpatch_callback: vmlinux test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': unpatching complete +transition: 'test_klp_callbacks_demo': unpatching complete % rmmod test_klp_callbacks_demo % rmmod test_klp_callbacks_mod test_klp_callbacks_mod: test_klp_callbacks_mod_exit
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../selftests/livepatch/test-callbacks.sh | 188 +++++++++--------- 1 file changed, 94 insertions(+), 94 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-callbacks.sh b/tools/testing/selftests/livepatch/test-callbacks.sh index 32b150e25b10..08a33c15bb29 100755 --- a/tools/testing/selftests/livepatch/test-callbacks.sh +++ b/tools/testing/selftests/livepatch/test-callbacks.sh @@ -38,23 +38,23 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -83,26 +83,26 @@ unload_mod $MOD_TARGET
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init $MOD_TARGET: ${MOD_TARGET}_init % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -133,26 +133,26 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
@@ -179,12 +179,12 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -196,12 +196,12 @@ $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
@@ -221,19 +221,19 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
@@ -258,13 +258,13 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko pre_patch_ret=-19 livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux livepatch: pre-patch callback failed for 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 +transition: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: No such device % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -297,12 +297,12 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo -19 > /sys/module/$MOD_LIVEPATCH/parameters/pre_patch_ret % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' @@ -311,12 +311,12 @@ livepatch: pre-patch callback failed for object '$MOD_TARGET' livepatch: patch '$MOD_LIVEPATCH' failed for module '$MOD_TARGET', refusing to load module '$MOD_TARGET' insmod: ERROR: could not insert module test_modules/$MOD_TARGET.ko: No such device % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
@@ -346,14 +346,14 @@ $MOD_TARGET_BUSY: busymod_work_func enter $MOD_TARGET_BUSY: busymod_work_func exit % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -365,14 +365,14 @@ $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET_BUSY $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_exit" @@ -426,10 +426,10 @@ $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_init $MOD_TARGET_BUSY: busymod_work_func enter % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': starting patching transition % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -439,12 +439,12 @@ $MOD_TARGET: ${MOD_TARGET}_exit livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': reversing transition from patching to unpatching -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': reversing transition from patching to unpatching +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET_BUSY $MOD_TARGET_BUSY: busymod_work_func exit @@ -469,34 +469,34 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH"
@@ -525,27 +525,27 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko replace=1 livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH"
The script test-ftrace.sh fails with the following error: $ sudo ./test-ftrace.sh TEST: livepatch interaction with ftrace_enabled sysctl ... not ok
- expected + result livepatch: kernel.ftrace_enabled = 0 % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) +transition: 'test_klp_livepatch': initializing patching transition livepatch: failed to patch object 'vmlinux' livepatch: failed to enable patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': canceling patching transition, going to unpatch -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': canceling patching transition, going to unpatch +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete insmod: ERROR: could not insert module test_modules/test_klp_livepatch.ko: Device or resource busy livepatch: kernel.ftrace_enabled = 1 % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../selftests/livepatch/test-ftrace.sh | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-ftrace.sh b/tools/testing/selftests/livepatch/test-ftrace.sh index 730218bce99c..04561e433e05 100755 --- a/tools/testing/selftests/livepatch/test-ftrace.sh +++ b/tools/testing/selftests/livepatch/test-ftrace.sh @@ -37,27 +37,26 @@ 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) +transition: '$MOD_LIVEPATCH': initializing patching transition 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 +transition: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$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 +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy % echo 0 > /sys/kernel/livepatch/$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 +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
From: George Guo guodongtai@kylinos.cn
The script test-callbacks.sh fails with the following error: $ sudo ./test-livepatch.sh TEST: basic function patching ... not ok
- expected + result % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../selftests/livepatch/test-livepatch.sh | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-livepatch.sh b/tools/testing/selftests/livepatch/test-livepatch.sh index bd13257bfdfe..1297a6bf2bdd 100755 --- a/tools/testing/selftests/livepatch/test-livepatch.sh +++ b/tools/testing/selftests/livepatch/test-livepatch.sh @@ -35,15 +35,15 @@ fi
check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH1/enabled -livepatch: '$MOD_LIVEPATCH1': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH1': starting unpatching transition -livepatch: '$MOD_LIVEPATCH1': completing unpatching transition -livepatch: '$MOD_LIVEPATCH1': unpatching complete +transition: '$MOD_LIVEPATCH1': initializing unpatching transition +transition: '$MOD_LIVEPATCH1': starting unpatching transition +transition: '$MOD_LIVEPATCH1': completing unpatching transition +transition: '$MOD_LIVEPATCH1': unpatching complete % rmmod $MOD_LIVEPATCH1"
@@ -79,31 +79,31 @@ grep 'live patched' /proc/meminfo > /dev/kmsg
check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete $MOD_LIVEPATCH1: this has been live patched % insmod test_modules/$MOD_REPLACE.ko replace=0 livepatch: enabling patch '$MOD_REPLACE' -livepatch: '$MOD_REPLACE': initializing patching transition -livepatch: '$MOD_REPLACE': starting patching transition -livepatch: '$MOD_REPLACE': completing patching transition -livepatch: '$MOD_REPLACE': patching complete +transition: '$MOD_REPLACE': initializing patching transition +transition: '$MOD_REPLACE': starting patching transition +transition: '$MOD_REPLACE': completing patching transition +transition: '$MOD_REPLACE': patching complete $MOD_LIVEPATCH1: this has been live patched $MOD_REPLACE: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_REPLACE/enabled -livepatch: '$MOD_REPLACE': initializing unpatching transition -livepatch: '$MOD_REPLACE': starting unpatching transition -livepatch: '$MOD_REPLACE': completing unpatching transition -livepatch: '$MOD_REPLACE': unpatching complete +transition: '$MOD_REPLACE': initializing unpatching transition +transition: '$MOD_REPLACE': starting unpatching transition +transition: '$MOD_REPLACE': completing unpatching transition +transition: '$MOD_REPLACE': unpatching complete % rmmod $MOD_REPLACE $MOD_LIVEPATCH1: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH1/enabled -livepatch: '$MOD_LIVEPATCH1': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH1': starting unpatching transition -livepatch: '$MOD_LIVEPATCH1': completing unpatching transition -livepatch: '$MOD_LIVEPATCH1': unpatching complete +transition: '$MOD_LIVEPATCH1': initializing unpatching transition +transition: '$MOD_LIVEPATCH1': starting unpatching transition +transition: '$MOD_LIVEPATCH1': completing unpatching transition +transition: '$MOD_LIVEPATCH1': unpatching complete % rmmod $MOD_LIVEPATCH1"
@@ -158,41 +158,41 @@ grep 'live patched' /proc/meminfo > /dev/kmsg
check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete $MOD_LIVEPATCH1: this has been live patched % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH3.ko livepatch: enabling patch '$MOD_LIVEPATCH3' -livepatch: '$MOD_LIVEPATCH3': initializing patching transition +transition: '$MOD_LIVEPATCH3': initializing patching transition $MOD_LIVEPATCH3: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH3': starting patching transition -livepatch: '$MOD_LIVEPATCH3': completing patching transition +transition: '$MOD_LIVEPATCH3': starting patching transition +transition: '$MOD_LIVEPATCH3': completing patching transition $MOD_LIVEPATCH3: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH3': patching complete +transition: '$MOD_LIVEPATCH3': patching complete % insmod test_modules/$MOD_REPLACE.ko replace=1 livepatch: enabling patch '$MOD_REPLACE' -livepatch: '$MOD_REPLACE': initializing patching transition -livepatch: '$MOD_REPLACE': starting patching transition -livepatch: '$MOD_REPLACE': completing patching transition -livepatch: '$MOD_REPLACE': patching complete +transition: '$MOD_REPLACE': initializing patching transition +transition: '$MOD_REPLACE': starting patching transition +transition: '$MOD_REPLACE': completing patching transition +transition: '$MOD_REPLACE': patching complete $MOD_REPLACE: this has been live patched % rmmod $MOD_LIVEPATCH3 % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH1 $MOD_REPLACE: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_REPLACE/enabled -livepatch: '$MOD_REPLACE': initializing unpatching transition -livepatch: '$MOD_REPLACE': starting unpatching transition -livepatch: '$MOD_REPLACE': completing unpatching transition -livepatch: '$MOD_REPLACE': unpatching complete +transition: '$MOD_REPLACE': initializing unpatching transition +transition: '$MOD_REPLACE': starting unpatching transition +transition: '$MOD_REPLACE': completing unpatching transition +transition: '$MOD_REPLACE': unpatching complete % rmmod $MOD_REPLACE"
From: George Guo guodongtai@kylinos.cn
$ sudo ./test-state.sh TEST: system state modification ... not ok
- expected + result % insmod test_modules/test_klp_state.ko livepatch: enabling patch 'test_klp_state' -livepatch: 'test_klp_state': initializing patching transition +transition: 'test_klp_state': initializing patching transition test_klp_state: pre_patch_callback: vmlinux test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: 'test_klp_state': starting patching transition -livepatch: 'test_klp_state': completing patching transition +transition: 'test_klp_state': starting patching transition +transition: 'test_klp_state': completing patching transition test_klp_state: post_patch_callback: vmlinux test_klp_state: fix_console_loglevel: fixing console_loglevel -livepatch: 'test_klp_state': patching complete +transition: 'test_klp_state': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_state/enabled -livepatch: 'test_klp_state': initializing unpatching transition +transition: 'test_klp_state': initializing unpatching transition test_klp_state: pre_unpatch_callback: vmlinux test_klp_state: restore_console_loglevel: restoring console_loglevel -livepatch: 'test_klp_state': starting unpatching transition -livepatch: 'test_klp_state': completing unpatching transition +transition: 'test_klp_state': starting unpatching transition +transition: 'test_klp_state': completing unpatching transition test_klp_state: post_unpatch_callback: vmlinux test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: 'test_klp_state': unpatching complete +transition: 'test_klp_state': unpatching complete % rmmod test_klp_state
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../testing/selftests/livepatch/test-state.sh | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-state.sh b/tools/testing/selftests/livepatch/test-state.sh index 10a52ac06185..887e9b4e8a77 100755 --- a/tools/testing/selftests/livepatch/test-state.sh +++ b/tools/testing/selftests/livepatch/test-state.sh @@ -21,23 +21,23 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
@@ -53,34 +53,34 @@ unload_lp $MOD_LIVEPATCH2
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % rmmod $MOD_LIVEPATCH % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2"
@@ -98,44 +98,44 @@ unload_lp $MOD_LIVEPATCH3
check_result "% insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH3.ko livepatch: enabling patch '$MOD_LIVEPATCH3' -livepatch: '$MOD_LIVEPATCH3': initializing patching transition +transition: '$MOD_LIVEPATCH3': initializing patching transition $MOD_LIVEPATCH3: pre_patch_callback: vmlinux $MOD_LIVEPATCH3: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH3': starting patching transition -livepatch: '$MOD_LIVEPATCH3': completing patching transition +transition: '$MOD_LIVEPATCH3': starting patching transition +transition: '$MOD_LIVEPATCH3': completing patching transition $MOD_LIVEPATCH3: post_patch_callback: vmlinux $MOD_LIVEPATCH3: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH3': patching complete +transition: '$MOD_LIVEPATCH3': patching complete % rmmod $MOD_LIVEPATCH2 % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH3"
@@ -151,26 +151,26 @@ unload_lp $MOD_LIVEPATCH2
check_result "% insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: Livepatch patch ($MOD_LIVEPATCH) is not compatible with the already installed livepatches. insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Invalid parameters % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2"
exit 0
From: George Guo guodongtai@kylinos.cn
The script test-syscall.sh fails with the following error:
$ sudo ./test-syscall.sh TEST: patch getpid syscall while being heavily hammered ... not ok
- expected + result % insmod test_modules/test_klp_syscall.ko klp_pids=18484,18485,18486,18487,18488,18489,18490,... livepatch: enabling patch 'test_klp_syscall' -livepatch: 'test_klp_syscall': initializing patching transition -livepatch: 'test_klp_syscall': starting patching transition -livepatch: 'test_klp_syscall': completing patching transition -livepatch: 'test_klp_syscall': patching complete +transition: 'test_klp_syscall': initializing patching transition +transition: 'test_klp_syscall': starting patching transition +transition: 'test_klp_syscall': completing patching transition +transition: 'test_klp_syscall': patching complete test_klp_syscall: Remaining not livepatched processes: 0 % echo 0 > /sys/kernel/livepatch/test_klp_syscall/enabled -livepatch: 'test_klp_syscall': initializing unpatching transition -livepatch: 'test_klp_syscall': starting unpatching transition -livepatch: 'test_klp_syscall': completing unpatching transition -livepatch: 'test_klp_syscall': unpatching complete +transition: 'test_klp_syscall': initializing unpatching transition +transition: 'test_klp_syscall': starting unpatching transition +transition: 'test_klp_syscall': completing unpatching transition +transition: 'test_klp_syscall': unpatching complete % rmmod test_klp_syscall
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../testing/selftests/livepatch/test-syscall.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-syscall.sh b/tools/testing/selftests/livepatch/test-syscall.sh index 289eb7d4c4b3..6493e1115add 100755 --- a/tools/testing/selftests/livepatch/test-syscall.sh +++ b/tools/testing/selftests/livepatch/test-syscall.sh @@ -41,16 +41,16 @@ unload_lp $MOD_SYSCALL
check_result "% insmod test_modules/$MOD_SYSCALL.ko klp_pids=$pid_list livepatch: enabling patch '$MOD_SYSCALL' -livepatch: '$MOD_SYSCALL': initializing patching transition -livepatch: '$MOD_SYSCALL': starting patching transition -livepatch: '$MOD_SYSCALL': completing patching transition -livepatch: '$MOD_SYSCALL': patching complete +transition: '$MOD_SYSCALL': initializing patching transition +transition: '$MOD_SYSCALL': starting patching transition +transition: '$MOD_SYSCALL': completing patching transition +transition: '$MOD_SYSCALL': patching complete $MOD_SYSCALL: Remaining not livepatched processes: 0 % echo 0 > /sys/kernel/livepatch/$MOD_SYSCALL/enabled -livepatch: '$MOD_SYSCALL': initializing unpatching transition -livepatch: '$MOD_SYSCALL': starting unpatching transition -livepatch: '$MOD_SYSCALL': completing unpatching transition -livepatch: '$MOD_SYSCALL': unpatching complete +transition: '$MOD_SYSCALL': initializing unpatching transition +transition: '$MOD_SYSCALL': starting unpatching transition +transition: '$MOD_SYSCALL': completing unpatching transition +transition: '$MOD_SYSCALL': unpatching complete % rmmod $MOD_SYSCALL"
exit 0
From: George Guo guodongtai@kylinos.cn
The script test-sysfs.sh fails with the following error:
$ sudo ./test-sysfs.sh TEST: sysfs test ... not ok
- expected + result % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
Signed-off-by: George Guo guodongtai@kylinos.cn --- .../testing/selftests/livepatch/test-sysfs.sh | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh index 05a14f5a7bfb..f9a27505d7a4 100755 --- a/tools/testing/selftests/livepatch/test-sysfs.sh +++ b/tools/testing/selftests/livepatch/test-sysfs.sh @@ -30,15 +30,15 @@ unload_lp $MOD_LIVEPATCH
check_result "% 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 +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$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 +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
start_test "sysfs test object/patched" @@ -59,12 +59,12 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/test_klp_callbacks_demo.ko livepatch: enabling patch 'test_klp_callbacks_demo' -livepatch: 'test_klp_callbacks_demo': initializing patching transition +transition: 'test_klp_callbacks_demo': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': starting patching transition -livepatch: 'test_klp_callbacks_demo': completing patching transition +transition: 'test_klp_callbacks_demo': starting patching transition +transition: 'test_klp_callbacks_demo': completing patching transition test_klp_callbacks_demo: post_patch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': patching complete +transition: 'test_klp_callbacks_demo': patching complete % insmod test_modules/test_klp_callbacks_mod.ko livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init @@ -76,12 +76,12 @@ test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled -livepatch: 'test_klp_callbacks_demo': initializing unpatching transition +transition: 'test_klp_callbacks_demo': initializing unpatching transition test_klp_callbacks_demo: pre_unpatch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': starting unpatching transition -livepatch: 'test_klp_callbacks_demo': completing unpatching transition +transition: 'test_klp_callbacks_demo': starting unpatching transition +transition: 'test_klp_callbacks_demo': completing unpatching transition test_klp_callbacks_demo: post_unpatch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': unpatching complete +transition: 'test_klp_callbacks_demo': unpatching complete % rmmod test_klp_callbacks_demo"
start_test "sysfs test replace enabled" @@ -97,15 +97,15 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko replace=1 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 +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$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 +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
start_test "sysfs test replace disabled" @@ -120,15 +120,15 @@ unload_lp $MOD_LIVEPATCH
check_result "% insmod test_modules/$MOD_LIVEPATCH.ko replace=0 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 +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$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 +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH"
exit 0
Hi,
On Thu, 21 Nov 2024, George Guo wrote:
From: George Guo guodongtai@kylinos.cn
The script test-callbacks.sh fails with the following error: $ sudo ./test-callbacks.sh TEST: target module before livepatch ... not ok
- expected
- result
test_klp_callbacks_mod: test_klp_callbacks_mod_init % insmod test_modules/test_klp_callbacks_demo.ko livepatch: enabling patch 'test_klp_callbacks_demo' -livepatch: 'test_klp_callbacks_demo': initializing patching transition +transition: 'test_klp_callbacks_demo': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting patching transition -livepatch: 'test_klp_callbacks_demo': completing patching transition +transition: 'test_klp_callbacks_demo': starting patching transition +transition: 'test_klp_callbacks_demo': completing patching transition test_klp_callbacks_demo: post_patch_callback: vmlinux test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': patching complete +transition: 'test_klp_callbacks_demo': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled -livepatch: 'test_klp_callbacks_demo': initializing unpatching transition +transition: 'test_klp_callbacks_demo': initializing unpatching transition test_klp_callbacks_demo: pre_unpatch_callback: vmlinux test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting unpatching transition -livepatch: 'test_klp_callbacks_demo': completing unpatching transition +transition: 'test_klp_callbacks_demo': starting unpatching transition +transition: 'test_klp_callbacks_demo': completing unpatching transition test_klp_callbacks_demo: post_unpatch_callback: vmlinux test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': unpatching complete +transition: 'test_klp_callbacks_demo': unpatching complete % rmmod test_klp_callbacks_demo % rmmod test_klp_callbacks_mod test_klp_callbacks_mod: test_klp_callbacks_mod_exit
ERROR: livepatch kselftest(s) failed
The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values.
This patch updates the expected test output to reflect the new log format.
are you sure? I have just run livepatch selftests on v6.12 and everything was fine.
The above suggests that something happened to KBUILD_MODNAME in your case (which would also mean that the fix should be different). Could you verify or provide more information, please?
Miroslav
linux-kselftest-mirror@lists.linaro.org