lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z+GnyGJxRFHhQR6U@redhat.com>
Date: Mon, 24 Mar 2025 14:43:20 -0400
From: Joe Lawrence <joe.lawrence@...hat.com>
To: Filipe Xavier <felipeaggger@...il.com>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>, Jiri Kosina <jikos@...nel.org>,
	Miroslav Benes <mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>,
	Shuah Khan <shuah@...nel.org>,
	Marcos Paulo de Souza <mpdesouza@...e.com>,
	live-patching@...r.kernel.org, linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org, felipe_life@...e.com
Subject: Re: [PATCH v2 2/2] selftests: livepatch: test if ftrace can trace a
 livepatched function

On Tue, Mar 18, 2025 at 06:20:36PM -0300, Filipe Xavier wrote:
> This new test makes sure that ftrace can trace a
> function that was introduced by a livepatch.
> 
> Signed-off-by: Filipe Xavier <felipeaggger@...il.com>
> ---
>  tools/testing/selftests/livepatch/test-ftrace.sh | 34 ++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/tools/testing/selftests/livepatch/test-ftrace.sh b/tools/testing/selftests/livepatch/test-ftrace.sh
> index fe14f248913acbec46fb6c0fec38a2fc84209d39..4937c74de0e4d34e4e692f20ee2bbe3cd6f5a232 100755
> --- a/tools/testing/selftests/livepatch/test-ftrace.sh
> +++ b/tools/testing/selftests/livepatch/test-ftrace.sh
> @@ -61,4 +61,38 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
>  % rmmod $MOD_LIVEPATCH"
>  
>  
> +# - verify livepatch can load
> +# - check if traces have a patched function
> +# - reset trace and unload livepatch
> +
> +start_test "trace livepatched function and check that the live patch remains in effect"
> +
> +FUNCTION_NAME="livepatch_cmdline_proc_show"
> +
> +load_lp $MOD_LIVEPATCH
> +trace_function "$FUNCTION_NAME"
> +
> +if [[ "$(cat /proc/cmdline)" == "$MOD_LIVEPATCH: this has been live patched" ]] ; then
> +	log "livepatch: ok"
> +fi
> +
> +check_traced_functions "$FUNCTION_NAME"
> +
> +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
> +livepatch: ok
> +% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled

A few months ago, 637c730998b8 ("selftests: livepatch: rename
KLP_SYSFS_DIR to SYSFS_KLP_DIR") tweaked the functions.sh::SYSFS_KLP_DIR
and then updated all of the test-*.sh scripts to use the variable
instead of the spelled out "/sys/kernel/livepatch" string.

So if there if there is another patchset version,
s/\/sys\/kernel\/livepatch/$SYSFS_KLP_DIR/g

-- Joe 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ