Skip to contentSkip to conversation

selftests/livepatch: Replace hardcoded path with variable in test-syscall.sh

PATCH In review George Guo 2 participants 6 messages Nov 25, 2024 – Dec 9, 2024

Subsystems (2)
lore
Share & tools
lore

George Guo

author
#0 lore raw

PATCH 1/2 selftests/livepatch: Replace hardcoded path with variable in test-syscall.sh

From: George Guo <[email protected]>

Updated test-syscall.sh to replace the path /sys/kernel/test_klp_syscall/npids with a variable $MOD_SYSCALL.

---
 tools/testing/selftests/livepatch/test-syscall.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/livepatch/test-syscall.sh +2 -2
index b76a881d4..9cfa17b6b 100755
@@ -24,9 +24,9 @@ pid_list=$(echo ${pids[@]} | tr ' ' ',')
 load_lp $MOD_SYSCALL klp_pids=$pid_list
 
 # wait for all tasks to transition to patched state
-loop_until 'grep -q '^0$' /sys/kernel/test_klp_syscall/npids'
+loop_until 'grep -q '^0$' /sys/kernel/$MOD_SYSCALL/npids'
 
-pending_pids=$(cat /sys/kernel/test_klp_syscall/npids)
+pending_pids=$(cat /sys/kernel/$MOD_SYSCALL/npids)
 log "$MOD_SYSCALL: Remaining not livepatched processes: $pending_pids"
 
 for pid in ${pids[@]}; do
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 selftests/livepatch: Replace hardcoded module name with variable in test-callbacks.sh

From: George Guo <[email protected]>

Replaced the hardcoded module name test_klp_callbacks_demo in the pre_patch_callback log message with the variable $MOD_LIVEPATCH.

---
 tools/testing/selftests/livepatch/test-callbacks.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/livepatch/test-callbacks.sh +1 -1
index 32b150e25..150cb68fe 100755
@@ -259,7 +259,7 @@ $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
-test_klp_callbacks_demo: pre_patch_callback: vmlinux
+$MOD_LIVEPATCH: 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
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH livepatch/master v1 2/2] selftests/livepatch: Replace hardcoded module name with variable in test-callbacks.sh

Quoted 6 lines · George Guo

From: George Guo <[email protected]>

Replaced the hardcoded module name test_klp_callbacks_demo in the pre_patch_callback log message with the variable $MOD_LIVEPATCH.

Best Regards,
Petr

author
#3 lore raw

Re: [PATCH livepatch/master v1 2/2] selftests/livepatch: Replace hardcoded module name with variable in test-callbacks.sh

Quoted 6 lines · On Tue, 26 Nov 2024 14:18:30 +0100 Petr Mladek <[email protected]> wrote:
Quoted 5 lines · George Guo

From: George Guo <[email protected]>

Replaced the hardcoded module name test_klp_callbacks_demo in the pre_patch_callback log message with the variable $MOD_LIVEPATCH.

Quoted 6 lines
Quoted 1 line

Best Regards,
Petr

Hi petr,

This patch could be merged?

Thanks!

maintainer
#4 lore raw

Re: [PATCH livepatch/master v1 2/2] selftests/livepatch: Replace hardcoded module name with variable in test-callbacks.sh

In reply to George Guo
Quoted 6 lines · George Guo

From: George Guo <[email protected]>

Replaced the hardcoded module name test_klp_callbacks_demo in the pre_patch_callback log message with the variable $MOD_LIVEPATCH.

JFYI, this patch has been committed into livepatching.git, branch for-6.14/selftests-trivial.

Best Regards,
Petr

maintainer
#5 lore raw
In reply to George Guo
Quoted 6 lines · George Guo

From: George Guo <[email protected]>

Updated test-syscall.sh to replace the path /sys/kernel/test_klp_syscall/npids with a variable $MOD_SYSCALL.

This has already been fixed by the commit 59766286b6e54f8ad33 ("selftests: livepatch: save and restore kprobe state"). The change reached the mainline last week during the merge window for 6.13.

Best Regards,
Petr