From: Steven Rostedt <rostedt@goodmis.org>
To: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Cc: <bpf@vger.kernel.org>, <linux-trace-kernel@vger.kernel.org>,
<live-patching@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<corbet@lwn.net>, <jpoimboe@kernel.org>, <shuah@kernel.org>,
<jolsa@kernel.org>, <mbenes@suse.cz>, <mhiramat@kernel.org>,
<stable@vger.kernel.org>, <linux-open-source@crowdstrike.com>
Subject: Re: [RFC PATCH bpf-next 2/2] selftests/livepatch: update test-ftrace.sh for deprecated ftrace_enabled
Date: Thu, 30 Jul 2026 20:09:13 -0400 [thread overview]
Message-ID: <20260730200913.59a541db@gandalf.local.home> (raw)
In-Reply-To: <20260730163544.2042327-3-andrey.grodzovsky@crowdstrike.com>
On Thu, 30 Jul 2026 12:35:44 -0400
Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com> wrote:
> kernel.ftrace_enabled=0 is now always refused, so the old scenario
> (disable, fail to load a livepatch, re-enable, load) no longer applies.
> Replace it with a single check that the write is refused with the new
> error, and drop the now-stale disable/reload flow.
>
> Assisted-by: Claude:claude-sonnet-5
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
> ---
> .../selftests/livepatch/test-ftrace.sh | 49 ++-----------------
> 1 file changed, 3 insertions(+), 46 deletions(-)
>
> diff --git a/tools/testing/selftests/livepatch/test-ftrace.sh b/tools/testing/selftests/livepatch/test-ftrace.sh
> index d2c3dea63104..c88f4d13a134 100755
> --- a/tools/testing/selftests/livepatch/test-ftrace.sh
> +++ b/tools/testing/selftests/livepatch/test-ftrace.sh
> @@ -9,56 +9,13 @@ MOD_LIVEPATCH=test_klp_livepatch
> setup_config
>
>
> -# - turn ftrace_enabled OFF and verify livepatches can't load
> -# - turn ftrace_enabled ON and verify livepatch can load
> -# - verify that ftrace_enabled can't be turned OFF while a livepatch is loaded
> +# - verify that kernel.ftrace_enabled=0 is refused (deprecated knob)
>
> -start_test "livepatch interaction with ftrace_enabled sysctl"
> +start_test "ftrace_enabled sysctl write is refused (deprecated)"
>
> -set_ftrace_enabled 0
> -load_failing_mod $MOD_LIVEPATCH
> -
> -set_ftrace_enabled 1
> -load_lp $MOD_LIVEPATCH
> -if [[ "$(cat /proc/cmdline)" != "$MOD_LIVEPATCH: this has been live patched" ]] ; then
> - echo -e "FAIL\n\n"
> - die "livepatch kselftest(s) failed"
> -fi
> -
This test should work for both old and new kernels. I would have it still
do everything here but if setting ftrace_enabled returns -EOPNOTSUPP then
do the simple path.
-- Steve
> -# Check that ftrace could not get disabled when a livepatch is enabled
> set_ftrace_enabled --fail 0
> -if [[ "$(cat /proc/cmdline)" != "$MOD_LIVEPATCH: this has been live patched" ]] ; then
> - echo -e "FAIL\n\n"
> - die "livepatch kselftest(s) failed"
> -fi
> -disable_lp $MOD_LIVEPATCH
> -unload_lp $MOD_LIVEPATCH
>
> -check_result "livepatch: kernel.ftrace_enabled = 0
> -% insmod test_modules/$MOD_LIVEPATCH.ko
> -livepatch: enabling patch '$MOD_LIVEPATCH'
> -livepatch: '$MOD_LIVEPATCH': initializing patching transition
> -livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16)
> -livepatch: failed to patch object 'vmlinux'
> -livepatch: failed to enable patch '$MOD_LIVEPATCH'
> -livepatch: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch
> -livepatch: '$MOD_LIVEPATCH': completing unpatching transition
> -livepatch: '$MOD_LIVEPATCH': unpatching complete
> -insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Device or resource busy
> -livepatch: kernel.ftrace_enabled = 1
> -% 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: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource busy
> -% echo 0 > $SYSFS_KLP_DIR/$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"
> +check_result "livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Operation not supported"
>
>
> # - verify livepatch can load
prev parent reply other threads:[~2026-07-31 0:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 16:35 [RFC PATCH bpf-next 0/2] ftrace: deprecate the ftrace_enabled disable switch Andrey Grodzovsky
2026-07-30 16:35 ` [RFC PATCH bpf-next 1/2] ftrace: deprecate disabling via ftrace_enabled sysctl Andrey Grodzovsky
2026-07-30 16:35 ` [RFC PATCH bpf-next 2/2] selftests/livepatch: update test-ftrace.sh for deprecated ftrace_enabled Andrey Grodzovsky
2026-07-31 0:09 ` Steven Rostedt [this message]
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=20260730200913.59a541db@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=andrey.grodzovsky@crowdstrike.com \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-open-source@crowdstrike.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mhiramat@kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.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