KernelScan.io

HIGH

tracing MarkerCopy UAF

CVE-2026-31541

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI7.8HIGH

01

In the Linux kernel, the following vulnerability has been resolved: tracing: Fix trace_marker copy link list updates When the "copy_trace_marker" option is enabled for an instance, anything written into /sys/kernel/tracing/trace_marker is also copied into that instances buffer. When the option is set, that instance's trace_array descriptor is added to the marker_copies link list. This list is protected by RCU, as all iterations uses an RCU protected list traversal. When the instance is deleted, all the flags that were enabled are cleared. This also clears the copy_trace_marker flag and removes the trace_array descriptor from the list. The issue is after the flags are called, a direct call to update_marker_trace() is performed to clear the flag. This function returns true if the state of the flag changed and false otherwise. If it returns true here, synchronize_rcu() is called to make sure all readers see that its removed from the list. But since the flag was already cleared, the state does not change and the synchronization is never called, leaving a possible UAF bug. Move the clearing of all flags below the updating of the copy_trace_marker option which then makes sure the synchronization is performed. Also use the flag for checking the state in update_marker_trace() instead of looking at if the list is empty.

02

Engine v0.2.0

Risk summary

A use-after-free vulnerability in the kernel tracing subsystem that occurs when deleting trace instances with copy_trace_marker enabled. The missing RCU synchronization can lead to kernel memory corruption when concurrent operations access freed trace instance data, potentially allowing privilege escalation or system crashes.

Affectedkernel/trace/trace.c

Vulnerability analysis

Root Cause: The vulnerability occurs in the trace instance deletion path where flags are cleared before calling update_marker_trace(). When copy_trace_marker flag is already cleared, update_marker_trace() returns false (no state change), causing synchronize_rcu() to be skipped. This leaves the trace_array descriptor in the RCU-protected marker_copies list while the instance is being freed, creating a use-after-free condition for concurrent readers traversing the list.

Attack Surface: Local attack surface requiring access to tracing subsystem through /sys/kernel/tracing/ interface. Exploitation requires ability to create/delete trace instances and manipulate copy_trace_marker option, typically requiring root privileges or specific capabilities.

Fix Mechanism: The patch reorders operations to call update_marker_trace() before clearing all flags, ensuring the function sees the flag transition and returns true when needed. This guarantees synchronize_rcu() is called to wait for all RCU readers to finish before the instance is freed. Additionally, the function now checks the actual flag state instead of list emptiness for more reliable state tracking.

03

BranchFixed inPatch commit
6.186.18.2075668e58244e
6.196.19.10cc267e4b4302
mainline7.007183aac4a68