{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139214","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2026-11-30T13:22:15.920Z","datePublished":"2026-11-30T13:32:38.695Z","dateUpdated":"2026-12-01T05:41:49.107Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-12-01T05:41:49.107Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nperf: Fix UAF in attach_task_ctx_data()\n\nstruct perf_ctx_data is RCU protected. In attach_task_ctx_data(),\nthe cmpxchg retry loop runs without holding rcu_read_lock(). If\ntask->perf_ctx_data already holds a pointer (call it `cd1`), then\ntry_cmpxchg(&task->perf_ctx_data, &old, cd) fails and loads old = cd1.\nA concurrent thread running detach_task_ctx_data() could free cd1\nleading to UAF and further memory corruption when cd1 is reclaimed by\nanother thread.\n\n  CPU 0: attach_task_ctx_data()     CPU 1: detach_task_ctx_data()\n  -----------------------------     -----------------------------\n  try_cmpxchg(&task->perf_ctx_data,\n              &old, cd2)\n    -> fails; loads old = cd1\n\n                                    refcount_dec_and_test(&cd1->refcount)\n                                    try_cmpxchg(&task->perf_ctx_data,\n                                                &cd1, NULL)\n                                    perf_free_ctx_data_rcu(cd1)\n                                    [ RCU grace period -> kfree(cd1) ]\n\n  refcount_inc_not_zero(&old->refcount)\n    -> UAF on freed cd1\n\nFix this by taking rcu_read_lock across the race window."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The freed perf_ctx_data is dereferenced in attach_task_ctx_data(), reached locally via perf_event_open() → perf_event_alloc() → attach_perf_ctx_data() for an x86 LBR call-stack event (PERF_ATTACH_TASK_DATA set in x86_pmu_hw_config). The free comes from close() → __free_event() → detach_task_ctx_data(); no remote data is involved.\nAC:L - The attacker controls both sides on their own thread: one thread opens LBR call-stack events while another closes the event holding the last ref. The stalled reader is the attacker's own syscall thread, whose scheduling they control (SCHED_IDLE, same-CPU hog), and failed attempts are harmless and retryable.\nPR:L - At the default perf_event_paranoid=2, an unprivileged user may open a per-task event on their own thread with exclude_kernel=1 and branch_sample_type USER|CALL_STACK. PERF_SAMPLE_BRANCH_PERM_PLM is unset, so perf_allow_kernel() is never called and no capability is needed. Only the cpu-wide (global) path needs CAP_PERFMON.\nUI:N - The attacker triggers both the attach and the detach with their own perf_event_open() and close() calls on their own task; no other user or administrator action is required.\nS:U - Corrupting a kernel heap object yields kernel-level compromise within the same kernel security authority; no hypervisor, IOMMU or other boundary is crossed.\nC:H - This is a use-after-free of a kmalloc-64 struct perf_ctx_data, a general cache the attacker can refill with sprayed objects. The resulting corruption of a reclaimed object can be built into kernel memory disclosure.\nI:H - refcount_inc_not_zero(&old->refcount) atomically increments the 32-bit field at offset 16 of whatever object now occupies the freed slot, and saturates it on overflow. This is a repeatable write primitive into an attacker-chosen victim object, usable for privilege escalation.\nA:H - Incrementing a field in a reallocated object corrupts unrelated kernel state, which can cause an oops, a refcount_t saturation WARN (a panic under panic_on_warn), or a crash in the victim object's user."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"],"versions":[{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","lessThan":"5d1869d012b475e9165c201a5cc71ad1ac92115a","status":"affected","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","lessThan":"b455bcb13502696e588c7a0e60a196851fb87474","status":"affected","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","lessThan":"64ea0e8226ed98d14e0231af1beae10c3d5c043a","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"],"versions":[{"version":"6.15","status":"affected"},{"version":"0","lessThan":"6.15","status":"unaffected","versionType":"semver"},{"version":"6.18.65","lessThanOrEqual":"6.18.*","status":"unaffected","versionType":"semver"},{"version":"7.3.6","lessThanOrEqual":"7.3.*","status":"unaffected","versionType":"semver"},{"version":"7.4-rc1","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"7.4-rc1"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/5d1869d012b475e9165c201a5cc71ad1ac92115a"},{"url":"https://git.kernel.org/stable/c/b455bcb13502696e588c7a0e60a196851fb87474"},{"url":"https://git.kernel.org/stable/c/64ea0e8226ed98d14e0231af1beae10c3d5c043a"}],"title":"perf: Fix UAF in attach_task_ctx_data()","x_generator":{"engine":"bippy-1.2.0"}}}}