CVE-2026-139214

perf: Fix UAF in attach_task_ctx_data()

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

perf: Fix UAF in attach_task_ctx_data()

struct perf_ctx_data is RCU protected. In attach_task_ctx_data(),
the cmpxchg retry loop runs without holding rcu_read_lock(). If
task->perf_ctx_data already holds a pointer (call it `cd1`), then
try_cmpxchg(&task->perf_ctx_data, &old, cd) fails and loads old = cd1.
A concurrent thread running detach_task_ctx_data() could free cd1
leading to UAF and further memory corruption when cd1 is reclaimed by
another thread.

CPU 0: attach_task_ctx_data() CPU 1: detach_task_ctx_data()
----------------------------- -----------------------------
try_cmpxchg(&task->perf_ctx_data,
&old, cd2)
-> fails; loads old = cd1

refcount_dec_and_test(&cd1->refcount)
try_cmpxchg(&task->perf_ctx_data,
&cd1, NULL)
perf_free_ctx_data_rcu(cd1)
[ RCU grace period -> kfree(cd1) ]

refcount_inc_not_zero(&old->refcount)
-> UAF on freed cd1

Fix this by taking rcu_read_lock across the race window.

Analysis

AI-generated

Technical impact

The vulnerability is a use‑after‑free flaw in the Linux kernel’s perf subsystem. In attach_task_ctx_data(), the operator cmpxchg executes without holding an RCU read lock, allowing a concurrent detach_task_ctx_data() to free the same struct perf_ctx_data that is still referenced by the attaching task. This race results in freeing an object that is still in use, leading to use‑after‑free and subsequent memory corruption. An attacker who can trigger concurrent attach and detach operations could corrupt kernel memory, which may enable arbitrary code execution with kernel privileges or cause a system crash.

Affected Systems

The affected system is the Linux kernel itself. No specific vendor or version list is supplied in the CVE data, but the issue exists in any Linux kernel build that includes the unpatched attach_task_ctx_data() function. The fix is applied through a patch in the upstream kernel source, referenced by commit identifiers in the provided links.

Risk and Exploitability

Because the CVSS and EPSS scores are not included, an exact severity cannot be quoted, but a use‑after‑free in kernel code is generally considered high to critical. The vulnerability can be exploited only in contexts where an attacker can influence kernel operations, such as local privilege escalation or code injection. It is not listed in the CISA KEV catalog, and no public exploit has been documented. Attacks would likely require a privileged or local attacker or a failure in isolation between user and kernel space. The primary mitigation is to update to a kernel that incorporates the patch.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update the operating system kernel to a release that incorporates the patch that protects attach_task_ctx_data() with rcu_read_lock
  • If an immediate kernel update is not feasible, backport the specific commit 5d1869d012b475e9165c201a5cc71ad1ac92115a (or the related patch) into the running kernel and rebuild
  • After applying the patch or kernel update, reboot the system to ensure the new kernel takes effect
  • Monitor kernel mailing lists and security advisories for new releases or backport patches in case your distribution lags behind

Generated by OpenCVE AI on November 30, 2026 at 20:54 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-416
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: perf: Fix UAF in attach_task_ctx_data() struct perf_ctx_data is RCU protected. In attach_task_ctx_data(), the cmpxchg retry loop runs without holding rcu_read_lock(). If task->perf_ctx_data already holds a pointer (call it `cd1`), then try_cmpxchg(&task->perf_ctx_data, &old, cd) fails and loads old = cd1. A concurrent thread running detach_task_ctx_data() could free cd1 leading to UAF and further memory corruption when cd1 is reclaimed by another thread. CPU 0: attach_task_ctx_data() CPU 1: detach_task_ctx_data() ----------------------------- ----------------------------- try_cmpxchg(&task->perf_ctx_data, &old, cd2) -> fails; loads old = cd1 refcount_dec_and_test(&cd1->refcount) try_cmpxchg(&task->perf_ctx_data, &cd1, NULL) perf_free_ctx_data_rcu(cd1) [ RCU grace period -> kfree(cd1) ] refcount_inc_not_zero(&old->refcount) -> UAF on freed cd1 Fix this by taking rcu_read_lock across the race window.
Title perf: Fix UAF in attach_task_ctx_data()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:32 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:18 PM
Modified
Nov 30, 2026, 2:18 PM