Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [STABLE REQUEST] ftrace: deprecate the ftrace_enabled disable switch
@ 2026-08-20 21:30 Andrey Grodzovsky
  2026-08-20 22:20 ` Steven Rostedt
  0 siblings, 1 reply; 10+ messages in thread
From: Andrey Grodzovsky @ 2026-08-20 21:30 UTC (permalink / raw)
  To: stable; +Cc: Greg KH, sashal, Steven Rostedt, DL Linux Open Source Team

Hello stable team,

Please consider backporting the following two commits to the stable trees:

  - b0c857049153680e1b6ccb59abf359a4ca523561 ("ftrace: deprecate
disabling via ftrace_enabled sysctl")
  - 88b3e7fedc07d940c32eb5c0733a780e944b6b47 ("selftests/livepatch:
update test-ftrace.sh for deprecated ftrace_enabled")

Both commits were merged into mainline in v7.3 via the 'ftrace-v7.3' tag.

This change addresses a long-standing issue: setting
kernel.ftrace_enabled=0 silently disables BPF trampolines
(fentry/fexit) and ftrace-based kprobes/kretprobes. The write succeeds
and the hooks stop firing without error, while re-enabling silently
restores them. Livepatch resolved this via FTRACE_OPS_FL_PERMANENT,
which blocks disabling ftrace while a permanent ops is registered and
blocks registration while ftrace is disabled. Trampolines had this
same protection from 2019 to 2022 while sharing a global direct_ops
marked permanent, but lost it during the 2022 per-trampoline-ops
split. ftrace based Kprobes never had this protection.

The breakage was introduced in commit 00963a2e75a8 ("bpf: Support
bpf_trampoline on functions with IPMODIFY (e.g. livepatch)").

With these commits, writing 0 is refused with -EOPNOTSUPP and a
one-time warning is logged; reads and writing 1 are unaffected. Steven
Rostedt requested and reviewed this change on the mailing list,
including the follow-up selftest update.

We would like to backport this to LTS branches starting with 6.1.y,
where the breaking commit already exists.

Mailing list threads for reference:

  - RFC v1: https://lore.kernel.org/bpf/20260730163544.2042327-1-andrey.grodzovsky@crowdstrike.com/
  - RFC v3 (final):
https://lore.kernel.org/bpf/20260806153000.4184871-1-andrey.grodzovsky@crowdstrike.com/

I can provide rebased backports for any trees where these commits do
not apply cleanly.

Thanks,
Andrey Grodzovsky

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-05 21:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 21:30 [STABLE REQUEST] ftrace: deprecate the ftrace_enabled disable switch Andrey Grodzovsky
2026-08-20 22:20 ` Steven Rostedt
2026-08-21 15:04   ` Andrey Grodzovsky
2026-11-04  2:51   ` Andrey Grodzovsky
2026-11-04 13:39     ` Steven Rostedt
2026-11-04 15:43       ` Andrey Grodzovsky
2026-11-04 16:02         ` Greg KH
2026-11-04 17:30         ` Steven Rostedt
2026-11-04 17:32           ` Andrey Grodzovsky
2026-11-05 21:22             ` Andrey Grodzovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox