[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CD7BF255-7128-412C-86EB-305CEC7FF2B7@gmail.com>
Date: Thu, 21 Nov 2024 09:36:25 +0800
From: zhang warden <zhangwarden@...il.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>,
Miroslav Benes <mbenes@...e.cz>,
Jiri Kosina <jikos@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Joe Lawrence <joe.lawrence@...hat.com>
Cc: live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3] selftests: livepatch: add test cases of stack_order
sysfs interface
> On Oct 24, 2024, at 16:35, Wardenjohn <zhangwarden@...il.com> wrote:
>
> Add selftest test cases to sysfs attribute 'stack_order'.
>
> Suggested-by: Petr Mladek <pmladek@...e.com>
> Signed-off-by: Wardenjohn <zhangwarden@...il.com>
> ---
> .../testing/selftests/livepatch/test-sysfs.sh | 71 +++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh
> index 05a14f5a7bfb..e44a051be307 100755
> --- a/tools/testing/selftests/livepatch/test-sysfs.sh
> +++ b/tools/testing/selftests/livepatch/test-sysfs.sh
> @@ -5,6 +5,8 @@
> . $(dirname $0)/functions.sh
>
> MOD_LIVEPATCH=test_klp_livepatch
> +MOD_LIVEPATCH2=test_klp_callbacks_demo
> +MOD_LIVEPATCH3=test_klp_syscall
>
> setup_config
>
> @@ -19,6 +21,8 @@ check_sysfs_rights "$MOD_LIVEPATCH" "enabled" "-rw-r--r--"
> check_sysfs_value "$MOD_LIVEPATCH" "enabled" "1"
> check_sysfs_rights "$MOD_LIVEPATCH" "force" "--w-------"
> check_sysfs_rights "$MOD_LIVEPATCH" "replace" "-r--r--r--"
> +check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
> +check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
> check_sysfs_rights "$MOD_LIVEPATCH" "transition" "-r--r--r--"
> check_sysfs_value "$MOD_LIVEPATCH" "transition" "0"
> check_sysfs_rights "$MOD_LIVEPATCH" "vmlinux/patched" "-r--r--r--"
> @@ -131,4 +135,71 @@ livepatch: '$MOD_LIVEPATCH': completing unpatching transition
> livepatch: '$MOD_LIVEPATCH': unpatching complete
> % rmmod $MOD_LIVEPATCH"
>
> +start_test "sysfs test stack_order value"
> +
> +load_lp $MOD_LIVEPATCH
> +
> +check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
> +
> +load_lp $MOD_LIVEPATCH2
> +
> +check_sysfs_value "$MOD_LIVEPATCH2" "stack_order" "2"
> +
> +load_lp $MOD_LIVEPATCH3
> +
> +check_sysfs_value "$MOD_LIVEPATCH3" "stack_order" "3"
> +
> +disable_lp $MOD_LIVEPATCH2
> +unload_lp $MOD_LIVEPATCH2
> +
> +check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
> +check_sysfs_value "$MOD_LIVEPATCH3" "stack_order" "2"
> +
> +disable_lp $MOD_LIVEPATCH3
> +unload_lp $MOD_LIVEPATCH3
> +
> +disable_lp $MOD_LIVEPATCH
> +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
> +% insmod test_modules/$MOD_LIVEPATCH2.ko
> +livepatch: enabling patch '$MOD_LIVEPATCH2'
> +livepatch: '$MOD_LIVEPATCH2': initializing patching transition
> +$MOD_LIVEPATCH2: pre_patch_callback: vmlinux
> +livepatch: '$MOD_LIVEPATCH2': starting patching transition
> +livepatch: '$MOD_LIVEPATCH2': completing patching transition
> +$MOD_LIVEPATCH2: post_patch_callback: vmlinux
> +livepatch: '$MOD_LIVEPATCH2': patching complete
> +% insmod test_modules/$MOD_LIVEPATCH3.ko
> +livepatch: enabling patch '$MOD_LIVEPATCH3'
> +livepatch: '$MOD_LIVEPATCH3': initializing patching transition
> +livepatch: '$MOD_LIVEPATCH3': starting patching transition
> +livepatch: '$MOD_LIVEPATCH3': completing patching transition
> +livepatch: '$MOD_LIVEPATCH3': patching complete
> +% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled
> +livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition
> +$MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux
> +livepatch: '$MOD_LIVEPATCH2': starting unpatching transition
> +livepatch: '$MOD_LIVEPATCH2': completing unpatching transition
> +$MOD_LIVEPATCH2: post_unpatch_callback: vmlinux
> +livepatch: '$MOD_LIVEPATCH2': unpatching complete
> +% rmmod $MOD_LIVEPATCH2
> +% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH3/enabled
> +livepatch: '$MOD_LIVEPATCH3': initializing unpatching transition
> +livepatch: '$MOD_LIVEPATCH3': starting unpatching transition
> +livepatch: '$MOD_LIVEPATCH3': completing unpatching transition
> +livepatch: '$MOD_LIVEPATCH3': unpatching complete
> +% rmmod $MOD_LIVEPATCH3
> +% 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
> +% rmmod $MOD_LIVEPATCH"
> +
> exit 0
> --
> 2.43.5
>
Hi, Petr.
Here to remind you not to forget this attribute for linux-6.13.
Thanks.
Wardenjohn
Powered by blists - more mailing lists