CVE-2025-38565: perf/core: Exit early on perf_mmap() fail
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
perf/core: Exit early on perf_mmap() fail
When perf_mmap() fails to allocate a buffer, it still invokes the event_mapped() callback of the related event. On X86 this might increase the perf_rdpmc_allowed reference counter. But nothing undoes this as perf_mmap_close() is never called in this case, which causes another reference count leak.
Return early on failure to prevent that.
The Linux kernel CVE team has assigned CVE-2025-38565 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.1.148 with commit 27d44145bd576bbef9bf6165bcd78128ec3e6cbd Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.6.102 with commit f41e9eba77bf97626e04296dc5677d02816d2432 Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.12.42 with commit 92043120a2e992800580855498ab8507e1b22db9 Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.15.10 with commit 163b0d1a209fe0df5476c1df2330ca12b55abf92 Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.16.1 with commit 7ff8521f30c4c2fcd4e88bd7640486602bf8a650 Issue introduced in 4.0 with commit 1e0fb9ec679c9273a641f1d6f3d25ea47baef2bb and fixed in 6.17-rc1 with commit 07091aade394f690e7b655578140ef84d0e8d7b0
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-38565
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
kernel/events/core.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/27d44145bd576bbef9bf6165bcd78128ec3e6cbd https://git.kernel.org/stable/c/f41e9eba77bf97626e04296dc5677d02816d2432 https://git.kernel.org/stable/c/92043120a2e992800580855498ab8507e1b22db9 https://git.kernel.org/stable/c/163b0d1a209fe0df5476c1df2330ca12b55abf92 https://git.kernel.org/stable/c/7ff8521f30c4c2fcd4e88bd7640486602bf8a650 https://git.kernel.org/stable/c/07091aade394f690e7b655578140ef84d0e8d7b0