Re: [PATCH 0/2] tracepoint: Fix stale probe data in system call tracepoints

From: Mathieu Desnoyers

Date: Fri Dec 04 2026 - 10:41:30 EST


On 2026-12-04 10:34, Andrea Parri wrote:
> 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.

Why not just fix tp_rcu_cond_sync() to handle the rcu tasks trace
sychronization which seems to be missing ?

Thanks,

Mathieu


>
> 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(-)
>


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com