From: sashiko-bot@kernel.org
To: "Andrey Grodzovsky" <andrey.grodzovsky@crowdstrike.com>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v3 1/2] ftrace: deprecate disabling via ftrace_enabled sysctl
Date: Thu, 06 Aug 2026 15:41:57 +0000 [thread overview]
Message-ID: <20260806154158.47BB01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806153000.4184871-2-andrey.grodzovsky@crowdstrike.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `kernel.ftrace_enabled` sysctl now returns `-EOPNOTSUPP` on writes of 0, but the livepatch kselftest was not updated to reflect this, causing the test suite to unconditionally abort.
- [Low] The `FTRACE_DISABLE_CALLS` macro and its handling branch are now dead code due to the removal of `ftrace_shutdown_sysctl()`.
--
--- Patch [1]: [RFC PATCH bpf-next v3 1/2] ftrace: deprecate disabling via ftrace_enabled sysctl ---
commit 97db09d0e1892d04fd743e6e22b088914ffd3dd6
Author: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Subject: ftrace: deprecate disabling via ftrace_enabled sysctl
Writing 0 to kernel.ftrace_enabled is now deprecated and returns -EOPNOTSUPP,
as it has not reliably disabled ftrace for years. The patch updates the
sysctl handler to refuse the write, log a warning, and leaves reads and
enabling unaffected.
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -9357,38 +9357,10 @@ static void ftrace_startup_sysctl(void)
> }
> }
>
> -static void ftrace_shutdown_sysctl(void)
> -{
> - int command;
> -
> - if (unlikely(ftrace_disabled))
> - return;
> -
> - /* ftrace_start_up is true if ftrace is running */
> - if (ftrace_start_up) {
> - command = FTRACE_DISABLE_CALLS;
> - if (ftrace_graph_active)
> - command |= FTRACE_STOP_FUNC_RET;
> - ftrace_run_update_code(command);
> - }
> -}
[Severity: Low]
Is FTRACE_DISABLE_CALLS now unused dead code?
The removed ftrace_shutdown_sysctl() function appears to be the only caller
that passes FTRACE_DISABLE_CALLS to ftrace_run_update_code().
Without it, the FTRACE_DISABLE_CALLS macro in include/linux/ftrace.h and
its corresponding handling branch in kernel/trace/ftrace.c might never be
executed:
kernel/trace/ftrace.c:ftrace_modify_all_code() {
...
else if (command & FTRACE_DISABLE_CALLS)
ftrace_replace_code(mod_flags);
...
}
Could we also clean up this macro and the dead branch?
[ ... ]
> @@ -9415,15 +9387,12 @@ ftrace_enable_sysctl(const struct ctl_table *table, int write,
> ftrace_startup_sysctl();
>
> } else {
> - if (is_permanent_ops_registered()) {
> - ftrace_enabled = true;
> - return -EBUSY;
> - }
> -
> - /* stopping ftrace calls (just send to ftrace_stub) */
> - ftrace_trace_function = ftrace_stub;
> -
> - ftrace_shutdown_sysctl();
> + /*
> + * Disabling ftrace at runtime via this knob is deprecated.
> + */
> + ftrace_enabled = true;
> + pr_warn_once("The ftrace_enabled file is deprecated and no longer disables ftrace\n");
> + return -EOPNOTSUPP;
> }
[Severity: Medium]
Will this cause the livepatch kselftests to unconditionally fail?
The test script tools/testing/selftests/livepatch/test-ftrace.sh calls
set_ftrace_enabled() to disable ftrace:
tools/testing/selftests/livepatch/test-ftrace.sh:
set_ftrace_enabled 0
Since writing 0 now returns -EOPNOTSUPP, the helper in functions.sh catches
the failure and aborts the entire test script:
tools/testing/selftests/livepatch/functions.sh:set_ftrace_enabled() {
...
if ! echo "$1" > /proc/sys/kernel/ftrace_enabled; then
skip "failed to set kernel.ftrace_enabled = $1"
fi
...
}
Does the kselftest suite need to be updated alongside this change to avoid
breaking the tests?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260806153000.4184871-1-andrey.grodzovsky@crowdstrike.com?part=1
next prev parent reply other threads:[~2026-08-06 15:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 15:29 [RFC PATCH bpf-next v3 0/2] ftrace: deprecate the ftrace_enabled disable switch Andrey Grodzovsky
2026-08-06 15:29 ` [RFC PATCH bpf-next v3 1/2] ftrace: deprecate disabling via ftrace_enabled sysctl Andrey Grodzovsky
2026-08-06 15:41 ` sashiko-bot [this message]
2026-08-06 21:21 ` Song Liu
2026-08-06 21:52 ` Andrey Grodzovsky
2026-08-09 18:32 ` Andrey Grodzovsky
2026-08-06 15:30 ` [RFC PATCH bpf-next v3 2/2] selftests/livepatch: update test-ftrace.sh for deprecated ftrace_enabled Andrey Grodzovsky
2026-08-06 21:18 ` Song Liu
2026-08-06 21:45 ` Andrey Grodzovsky
2026-08-07 0:51 ` Steven Rostedt
2026-08-07 7:17 ` Song Liu
2026-08-07 12:42 ` Steven Rostedt
2026-08-07 16:16 ` Song Liu
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=20260806154158.47BB01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andrey.grodzovsky@crowdstrike.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.