From: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
To: <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>
Cc: <rostedt@goodmis.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: [RFC PATCH bpf-next 0/2] ftrace: deprecate the ftrace_enabled disable switch
Date: Thu, 30 Jul 2026 12:35:42 -0400 [thread overview]
Message-ID: <20260730163544.2042327-1-andrey.grodzovsky@crowdstrike.com> (raw)
This fixes a long-standing issue: kernel.ftrace_enabled=0 silently
disables BPF trampolines (fentry/fexit) and ftrace-based
kprobes/kretprobes. The write succeeds, the hook stops firing with no
error, and re-enabling silently restores it.
The solution chosen is to deny setting this knob to 0 from userspace,
thus preventing this case in the first place. Steven mentioned that the
switch became effectively useless and doesn't serve any meaningful
purpose anymore, and only creates problems for systems that rely on
ftrace, such as Livepatching and eBPF. Any attempt to set it to 0 will
fail with -EOPNOTSUPP. Reading and writing 1 remain unchanged.
Patch 1: the sysctl change plus a doc note.
Patch 2: updates the one selftest that relied on the old disable
behavior.
This replaces an earlier attempt[1] to restore FTRACE_OPS_FL_PERMANENT
on BPF trampolines and classic kprobes to work around the same issue.
Steven suggested this simpler approach instead: rather than
tracking down every caller that needs protecting, refuse to disable
ftrace via the sysctl unconditionally.
The original patch-set was a fix to commit 00963a2e75a8 ("bpf: Support
bpf_trampoline on functions with IPMODIFY (e.g. livepatch)"), and so we
would want to see this backported at least to LTS branches starting
with 6.1. But since this is effectively a new behavior and technically not a bug
fix, I am not sure what the policy is in this case.
[1] https://lore.kernel.org/bpf/20260729005959.3853865-1-andrey.grodzovsky@crowdstrike.com/
Andrey Grodzovsky (2):
ftrace: deprecate disabling via ftrace_enabled sysctl
selftests/livepatch: update test-ftrace.sh for deprecated
ftrace_enabled
Documentation/trace/ftrace.rst | 5 ++
kernel/trace/ftrace.c | 19 +++----
.../selftests/livepatch/test-ftrace.sh | 49 ++-----------------
3 files changed, 16 insertions(+), 57 deletions(-)
--
2.34.1
next reply other threads:[~2026-07-30 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 16:35 Andrey Grodzovsky [this message]
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
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=20260730163544.2042327-1-andrey.grodzovsky@crowdstrike.com \
--to=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=rostedt@goodmis.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