CVE-2025-22035
tracing: Fix use-after-free in print_graph_function_flags during tracer switching
Reported by linux · Published April 16, 2025
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/
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| perf | Amazon Linux | 6.1.134-150.224.amzn2023 |
| kernel-headers | Amazon Linux | 6.1.134-150.224.amzn2023 |
| kernel-livepatch-6.1.134-150.224 | Amazon Linux | 1.0-0.amzn2023 |
| python3-perf | Amazon Linux | 6.1.134-150.224.amzn2023 |
| kernel6.12-modules-extra | Amazon Linux | 6.12.23-29.97.amzn2023 |
| perf6.12 | Amazon Linux | 6.12.23-29.97.amzn2023 |
| kernel-modules-extra-common | Amazon Linux | 6.1.134-150.224.amzn2023 |
| linux_kernel | linux | 6.14.2, 6.13.11, 6.12.23, 6.6.87, 6.1.134, 5.15.180, 5.10.236, 5.4.292, 4.20, 4.15 |
| Linux | Linux | a2cce54c1748216535dda02e185d07a084be837e, 7f81f27b1093e4895e87b74143c59c055c3b1906, 6.5, 5.15.180, 42561fe62c3628ea3bc9623f64f047605e98857f, 4.20, 4.15 |
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 05319d707732c728eb721ac616a50e7978eb499a, b8205dfed68183dc1470e83863c5ded6d7fa30a9, ce6e2b14bc094866d9173db6935da2d752f06d8b |
| Linux | Linux | 6.5, 0, 5.4.292 |
| amazon:2023 | perf | 0 |
| amazon:2023 | kernel-headers | 0 |
| amazon:2023 | kernel-livepatch-6.1.134-150.224 | 0 |
| amazon:2023 | python3-perf | 0 |
| amazon:2023 | kernel6.12-modules-extra | 0 |
| amazon:2023 | perf6.12 | 0 |
| amazon:2023 | kernel-modules-extra-common | 0 |
| Linux | Linux | 6.4.13, 0, 5.4.292 |
| amazon:2023 | python3-perf6.12 | 0 |
| amazon:2023 | kernel-libbpf-devel | 0 |
| amazon:2023 | kernel-devel | 0 |
| amazon:2023 | kernel-livepatch-6.12.23-29.97 | 0 |
| amazon:2023 | kernel6.12 | 0 |
| amazon:2023 | kernel-libbpf | 0 |
| linux | linux_kernel | 6.1.50, 4.19.293, 5.10.193 |
| amazon:2023 | kernel-tools | 0 |
| amazon:2023 | kernel-libbpf-static | 0 |
| amazon:2023 | bpftool | 0 |
…and 3 more
Timeline
- Apr 16, 2025 CVE Published
- Apr 17, 2025 EPSS Score (30 in total, the first dated here)
- Apr 25, 2025 Coalition ESS Score (19 in total, the first dated here)
- Oct 12, 2025 PoC Published (5 in total, the first dated here)
- Dec 21, 2025 Security Advisory (328 in total, the first dated here)
- Apr 20, 2026 Distribution Patch (321 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2025-22035
vulnetix vdb fixes CVE-2025-22035
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2025-22035/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart