{"id":"CVE-2026-139214","state":"PUBLISHED","title":"perf: Fix UAF in attach_task_ctx_data()","description":"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.","publishedAt":"2026-11-30T13:32:38.695Z","updatedAt":"2026-11-30T13:32:38.695Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"5d1869d012b475e9165c201a5cc71ad1ac92115a","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"b455bcb13502696e588c7a0e60a196851fb87474","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"64ea0e8226ed98d14e0231af1beae10c3d5c043a","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"]}],"references":["https://git.kernel.org/stable/c/5d1869d012b475e9165c201a5cc71ad1ac92115a","https://git.kernel.org/stable/c/b455bcb13502696e588c7a0e60a196851fb87474","https://git.kernel.org/stable/c/64ea0e8226ed98d14e0231af1beae10c3d5c043a"],"weaknesses":[],"ingestedAt":"2026-11-30T13:44:05.999Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139214.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139214","state":"PUBLISHED","datePublished":"2026-11-30T13:32:38.695Z","dateUpdated":"2026-11-30T13:32:38.695Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.920Z"},"containers":{"cna":{"title":"perf: Fix UAF in attach_task_ctx_data()","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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"5d1869d012b475e9165c201a5cc71ad1ac92115a","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"b455bcb13502696e588c7a0e60a196851fb87474","versionType":"git"},{"version":"506e64e710ff9573fd2b86686528762b7901b5e4","status":"affected","lessThan":"64ea0e8226ed98d14e0231af1beae10c3d5c043a","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/events/core.c"]}],"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"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:32:38.695Z"},"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"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}