Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Filipe Xavier <felipeaggger@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	Petr Mladek <pmladek@suse.com>, Shuah Khan <shuah@kernel.org>,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, felipe_life@live.com
Subject: Re: [PATCH v2 2/2] selftests: livepatch: test if ftrace can trace a livepatched function
Date: Mon, 24 Mar 2025 14:43:20 -0400	[thread overview]
Message-ID: <Z+GnyGJxRFHhQR6U@redhat.com> (raw)
In-Reply-To: <20250318-ftrace-sftest-livepatch-v2-2-60cb0aa95cca@gmail.com>

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@gmail.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 


  reply	other threads:[~2025-03-24 18:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 21:20 [PATCH v2 0/2] selftests: livepatch: test if ftrace can trace a livepatched function Filipe Xavier
2025-03-18 21:20 ` [PATCH v2 1/2] selftests: livepatch: add new ftrace helpers functions Filipe Xavier
2025-03-24 18:22   ` Joe Lawrence
2025-03-24 18:36   ` Joe Lawrence
2025-03-24 22:49     ` Filipe Xavier
2025-03-18 21:20 ` [PATCH v2 2/2] selftests: livepatch: test if ftrace can trace a livepatched function Filipe Xavier
2025-03-24 18:43   ` Joe Lawrence [this message]
2025-03-21 13:13 ` [PATCH v2 0/2] " Miroslav Benes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z+GnyGJxRFHhQR6U@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=felipe_life@live.com \
    --cc=felipeaggger@gmail.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mpdesouza@suse.com \
    --cc=pmladek@suse.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox