[PATCH] selftests/livepatch: Ignore NO_SUPPORT line in dmesg

Ricardo B. Marlière posted 1 patch 1 month, 2 weeks ago
tools/testing/selftests/livepatch/functions.sh | 1 +
1 file changed, 1 insertion(+)
[PATCH] selftests/livepatch: Ignore NO_SUPPORT line in dmesg
Posted by Ricardo B. Marlière 1 month, 2 weeks ago
Some systems might disable unloading a livepatch and when running tests on
them they fail like the following:

$ ./run_kselftest.sh -c livepatch
  TAP version 13
  1..8
  # selftests: livepatch: test-livepatch.sh
  # TEST: basic function patching ... not ok
  #
  # --- expected
  # +++ result
  # @@ -5,6 +5,7 @@ livepatch: 'test_klp_livepatch': starting
  #  livepatch: 'test_klp_livepatch': completing patching transition
  #  livepatch: 'test_klp_livepatch': patching complete
  #  % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled
  # +livepatch: attempt to disable live patch test_klp_livepatch, setting
  NO_SUPPORT taint flag
  #  livepatch: 'test_klp_livepatch': initializing unpatching transition
  #  livepatch: 'test_klp_livepatch': starting unpatching transition
  #  livepatch: 'test_klp_livepatch': completing unpatching transition
  #
  # ERROR: livepatch kselftest(s) failed

Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
 tools/testing/selftests/livepatch/functions.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index 46991a029f7c64ace3945727b3540521ffe2e529..13fc289962cdd77c9fc4eaf1ad336775d6db710d 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -321,6 +321,7 @@ function check_result {
 	result=$(dmesg | awk -v last_dmesg="$LAST_DMESG" 'p; $0 == last_dmesg { p=1 }' | \
 		 grep -e 'livepatch:' -e 'test_klp' | \
 		 grep -v '\(tainting\|taints\) kernel' | \
+		 grep -v 'setting NO_SUPPORT taint flag' | \
 		 sed 's/^\[[ 0-9.]*\] //' | \
 		 sed 's/^\[[ ]*[CT][0-9]*\] //')
 

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250819-selftests-lp_taint_flag-c96f5b9b2ed9

Best regards,
-- 
Ricardo B. Marlière <rbm@suse.com>

Re: [PATCH] selftests/livepatch: Ignore NO_SUPPORT line in dmesg
Posted by Petr Mladek 1 month, 2 weeks ago
On Tue 2025-08-19 14:37:01, Ricardo B. Marlière wrote:
> Some systems might disable unloading a livepatch and when running tests on
> them they fail like the following:
> 
> $ ./run_kselftest.sh -c livepatch
>   TAP version 13
>   1..8
>   # selftests: livepatch: test-livepatch.sh
>   # TEST: basic function patching ... not ok
>   #
>   # --- expected
>   # +++ result
>   # @@ -5,6 +5,7 @@ livepatch: 'test_klp_livepatch': starting
>   #  livepatch: 'test_klp_livepatch': completing patching transition
>   #  livepatch: 'test_klp_livepatch': patching complete
>   #  % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled
>   # +livepatch: attempt to disable live patch test_klp_livepatch, setting
>   NO_SUPPORT taint flag
>   #  livepatch: 'test_klp_livepatch': initializing unpatching transition
>   #  livepatch: 'test_klp_livepatch': starting unpatching transition
>   #  livepatch: 'test_klp_livepatch': completing unpatching transition
>   #
>   # ERROR: livepatch kselftest(s) failed

This seems to be a SUSE-specific feature. The upstream kernel does not
even know the NO_SUPPORT taint flag.

This patch is not for upstream. But we should add it into SUSE
kernel sources.

Best Regards,
Petr
Re: [PATCH] selftests/livepatch: Ignore NO_SUPPORT line in dmesg
Posted by Ricardo B. Marlière 1 month, 2 weeks ago
On Tue Aug 19, 2025 at 2:37 PM -03, Ricardo B. Marlière wrote:
> Some systems might disable unloading a livepatch and when running tests on
> them they fail like the following:

oops, sorry..

Please ignore this patch, this should be handled downstream along with
https://github.com/openSUSE/kernel-source/blob/SL-16.0/patches.suse/livepatch-mark-the-kernel-unsupported-when-disabling.patch
...