CVE-2026-99141: tracing: Fix crash in print_graph_function_event()
In the Linux kernel, the following vulnerability has been resolved:
tracing: Fix crash in printgraphfunctionevent()
tracingsettracer() assigns the flags of the newly selected tracer with:
tr->currenttraceflags = t->flags ? : t->tracer->flags;
If the new tracer defines neither static flags nor default flags, like hwlat, irqsoff or wakeup, addtracer() has no per instance flags copy for it, and both operands are NULL, so tr->currenttraceflags ends up being NULL as well.
The ring buffer is not cleared when switching tracers: it is reset inside tracerinit(), after currenttraceflags was already assigned. If the buffer still holds functiongraph entries of the previous tracer, printing one of them dereferences the NULL pointer. This was hit by cat trace during an ftrace stress test:
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode RIP: 0010:printgraphfunctionevent+0xe/0x20 Call Trace: sshow+0x4d/0x110 seqreaditer+0x2d4/0x490 seqread+0x130/0x170 vfsread+0xb5/0x370 ksysread+0x6d/0xe0 dosyscall64+0xbc/0x450
The snapshot buffer is not reset at all, so this can be reproduced without a race:
echo functiongraph > /sys/kernel/tracing/currenttracer echo 1 > /sys/kernel/tracing/snapshot echo hwlat > /sys/kernel/tracing/currenttracer cat /sys/kernel/tracing/snapshot
Rather than teaching every user of tr->currenttraceflags about this corner case, make sure it is never NULL: when the newly selected tracer has no flags at all, tracingsettracer() falls back to a static empty notracerflags. runtracerselftest() can hit the same case, so the same fallback is added there too. The existing users already handle opts == NULL, so these tracers keep behaving as before.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.2.13 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.13-1
Event History
Frequently Asked Questions
What conditions are required to trigger the crash?
The trace buffer or snapshot buffer must retain function_graph entries from a previously selected tracer. The tracer must then be switched to one that has neither static nor default flags, such as hwlat, irqsoff, or wakeup, after which reading the trace can dereference a NULL trace-flags pointer.
Is this limited to a timing race?
No. Although retained ring-buffer entries can produce the issue during tracer switching, the snapshot buffer is not reset and can reproduce the problem without a race.
How might an affected system present?
Reading the trace, including with cat trace, can cause a kernel NULL-pointer dereference in print_graph_function_event(). The reported call path includes s_show, seq_read_iter, and seq_read.