CVE-2025-22035: tracing: Fix use-after-free in print_graph_function_flags during tracer switching
In the Linux kernel, the following vulnerability has been resolved:
tracing: Fix use-after-free in print_graph_function_flags during tracer switching
Kairui reported a UAF issue in print_graph_function_flags() during
ftrace stress testing [1]. This issue can be reproduced if puting a
'mdelay(10)' after 'mutex_unlock(&trace_types_lock)' in s_start(),
and executing the following script:
$ echo function_graph > current_tracer
$ cat trace > /dev/null &
$ sleep 5 # Ensure the 'cat' reaches the 'mdelay(10)' point
$ echo timerlat > current_tracer
The root cause lies in the two calls to print_graph_function_flags
within print_trace_line during each s_show():
* One through 'iter->trace->print_line()';
* Another through 'event->funcs->trace()', which is hidden in
print_trace_fmt() before print_trace_line returns.
Tracer switching only updates the former, while the latter continues
to use the print_line function of the old tracer, which in the script
above is print_graph_function_flags.
Moreover, when switching from the 'function_graph' tracer to the
'timerlat' tracer, s_start only calls graph_trace_close of the
'function_graph' tracer to free 'iter->private', but does not set
it to NULL. This provides an opportunity for 'event->funcs->trace()'
to use an invalid 'iter->private'.
To fix this issue, set 'iter->private' to NULL immediately after
freeing it in graph_trace_close(), ensuring that an invalid pointer
is not passed to other tracers. Additionally, clean up the unnecessary
'iter->private = NULL' during each 'cat trace' when using wakeup and
irqsoff tracers.
[1] https://lore.kernel.org/all/20231112150030.84609-1-ryncsn@gmail.com/
Security readout for executives and security teams
Plain-English summary
CVE-2025-22035 is a Linux kernel use-after-free in tracing during tracer switching. A local user with required privileges could trigger memory corruption with potential confidentiality, integrity, and availability impact. It is serious for shared Linux hosts and systems where untrusted users can access tracing controls.
Executive priority
Patch on the normal high-priority kernel security cadence, faster for multi-user or shared infrastructure. No active exploitation is shown, but the impact profile is high because kernel memory corruption can undermine host security boundaries once local access exists.
Technical view
The flaw is in ftrace tracing: print_graph_function_flags can use iter->private after graph_trace_close frees it during a switch from function_graph to another tracer. The resolved fix clears iter->private after freeing it. The source assigns CVSS 3.1 score 7.8 with local attack vector and low privileges.
Likely exposure
Exposure is limited to Linux systems running affected kernel versions with local users able to interact with tracing facilities. The source bundle identifies Linux as the affected product and includes stable kernel commit references and Debian LTS advisories. Exact package exposure should be checked against each distribution kernel build.
Exploitation context
The source describes a stress-test reproduction and local attack characteristics, but does not cite public exploitation in the wild. KEV is false in the provided bundle. Treat this as a local privilege-impact kernel memory-safety issue, not a confirmed active exploitation event.
Researcher notes
Evidence supports CWE-416 use-after-free in Linux tracing. The root cause and fix are described, but product impact is only Linux kernel and distro-specific mapping is incomplete in the bundle. Avoid assuming exploitability beyond the stated local, low-privilege CVSS vector.
Mitigation direction
Update affected Linux kernels using vendor or distribution security advisories.
Prioritize shared hosts, CI runners, and multi-user Linux systems.
Track whether deployed kernels include the referenced stable commits.
Use distribution guidance for backported fixes and package names.
Limit local user access to tracing controls where operationally feasible.
Validation and detection
Inventory Linux kernel versions across production and shared environments.
Compare running kernels with vendor fixed builds or referenced stable commits.
Check Debian LTS advisories if using Debian-derived kernels.
Confirm reboot into the patched kernel after package installation.
Review local access paths to kernel tracing interfaces.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-416: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
2ADP providers
12Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-416 · source CWE mapping
Use After Free
Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.