From: Andrea Parri <parri.andrea@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: [PATCH 0/2] tracepoint: Fix stale probe data in system call tracepoints
Date: Fri, 4 Dec 2026 16:34:49 +0100 [thread overview]
Message-ID: <20261204153452.17096-1-parri.andrea@gmail.com> (raw)
System call tracepoints protect their probes with RCU Tasks Trace
only, but switching a static call to a single probe waits only for RCU
and tracepoint_srcu readers. A preempted reader can then call the new
probe with the old probe's data, and crash in ftrace_syscall_enter() or
bpf_trace_run2().
Patch 1 fixes this by keeping the static call of faultable tracepoints
on __traceiter_*(), which loads each probe together with its data.
Patch 2 drops what faultable tracepoints no longer need: the static
call update and the grace period snapshots and waits. Patch 1 alone
fixes the bug, so patch 2 can wait for the next merge window, or be
squashed into patch 1 if that is preferred.
Tested on v7.4-rc5 in x86-64 KVM guests, with the test-only hook below
the --- of patch 1, which also has the reproducer for 2 -> 1. Both
race sequences oops in 3 of 3 runs without the series, and in none
with patch 1 alone or with both patches. ftracetest: 164 passed,
0 failed in all three cases.
With perf_syscall_enter() as the only sys_enter probe, getppid() takes
153.6 ns with the series and 153.2 ns without it. With patch 1 alone,
whose reader path is the same, another pair of builds measured 155.9
and 153.7 ns: a difference of 2.2 ns, against 0.4 ns for the series.
The bug was found with the help of an LLM, which was also used to write
both patches, their changelogs and the tests.
Andrea Parri (2):
tracepoint: Always use the iterator for faultable tracepoints
tracepoint: Drop static call switching for faultable tracepoints
kernel/tracepoint.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
--
2.53.0
next reply other threads:[~2026-12-04 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 15:34 Andrea Parri [this message]
2026-12-04 15:34 ` [PATCH 1/2] tracepoint: Always use the iterator for faultable tracepoints Andrea Parri
2026-12-04 15:34 ` [PATCH 2/2] tracepoint: Drop static call switching " Andrea Parri
2026-12-04 15:41 ` [PATCH 0/2] tracepoint: Fix stale probe data in system call tracepoints Mathieu Desnoyers
2026-12-04 15:51 ` Andrea Parri
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=20261204153452.17096-1-parri.andrea@gmail.com \
--to=parri.andrea@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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