[DTrace-devel] [PATCH] Change stack_skip to 3

Nick Alcock nick.alcock at oracle.com
Fri Jan 23 19:05:57 UTC 2026


On 21 Jan 2026, eugene loh told this:

> From: Eugene Loh <eugene.loh at oracle.com>
>
> For most probes, bpf_get_stack() strips off artificial BPF JIT stack
> frames.  In a few cases -- like fprobes and rawtp -- we have to skip
> the first few frames manually.  Typically, we should skip 3 frames
> (trampoline, clause, and the bpf_get_stack call itself).  Further,
> our BPF functions like
>     get_bvar_caller()
>     get_bvar_stackdepth()
>     get_bvar_ucaller()
>     get_bvar_ustackdepth()
> skip an additional frame to account for that call.
>
> Change stack_skip to 3 for the dt_fbt_fprobe and dt_rawtp providers.
>
> This raises the thorny question of testing.  Until recently, the
> stack_skip value we had been using -- 4, not 3 -- worked since it was
> chosen empirically:  there was a bug in the kernel that added an extra
> frame.  But now, the kernel situation is muddled.  The bug has been
> fixed in recent kernels, but only for x86.  See
>
> https://github.com/torvalds/linux/commit/6d08340d1e354787d6c65a8c3cdd4d41ffb8a5ed
> Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()"
>
> A broader fix, for non-x86, is also expected.  See the thread that
> starts at:
> https://lore.kernel.org/all/a38fed68-67bc-98ce-8e12-743342121ae3@oracle.com/
>
> So, for now, XFAIL tests on "unfixed" (older) kernels.
>
> Orabug: 38776929
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Nick Alcock <nick.alcock at oracle.com>

(verified that it fixes these tests and doesn't break older kernels,
which XFAIL with the appropriate message.)

-- 
NULL && (void)



More information about the DTrace-devel mailing list