Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D3CE277008 for ; Tue, 19 Aug 2025 17:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755623929; cv=none; b=OdT1krChpdq/LSXmdap0oJ9SyAZQs4Fj/M+JcVEfZY2BR9ceuC+Awd3kRIA6Kf/fE/uPdXdHYlE1LeE2a+1aitvKDWoJi9i2yUdoAGWnzK4+PFf0JJS6HH6yP4rhsjrHu1FvxKsuIVydGMKNIujrWoeNMrG5T1AHQp47lrtaVTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755623929; c=relaxed/simple; bh=a/LgYIO7Sqd0ILOqCeVO+iI8wGRCDD0mojqHZScpOto=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IUwfKVze/snPc4YTJGAiN0XUJ6E5mUuWRnlqHL4X0m6bWfu1e5Wu1c0j03soMozRGFGvAN7BnvDnczEwNL48PZ4+SOL7V9OQcHAZcHekDkf/PxMeNuYv3utIIgTrXEWZElz+z5XmxIm+++6XTIQTvk9fmasui1shokiqaKId8hs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wUaT+yjM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wUaT+yjM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B7CC4CEF1; Tue, 19 Aug 2025 17:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755623928; bh=a/LgYIO7Sqd0ILOqCeVO+iI8wGRCDD0mojqHZScpOto=; h=From:To:Cc:Subject:Date:Reply-to:From; b=wUaT+yjMWI+7H9A63Jq0Woxu/D5QZAriNwzhOYO9CGooLQg7WoHwUrYyeR9AF1BQU xOXSXpAWjhTKYHrFihQ+fFTP4uRWb5aV23jOTo26JVf3sH/uq/nxC3s3J2sbqcL0EF +FTiC3viKoFF80HxMHCU8Ji4I4bUyYOdhAqpzzDw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38564: perf/core: Handle buffer mapping fail correctly in perf_mmap() Date: Tue, 19 Aug 2025 19:18:11 +0200 Message-ID: <2025081908-CVE-2025-38564-efa3@gregkh> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2803; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=a4gnvXxWKlYhr2G1hT/RzT9fsCSGOSZ7V+Vv2YQjSXw=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlLNl5IfnHqF/fG8683VzlMuxfKcl9E/PPlzV+MKv02J BcXHVS82xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATYQ5lmCui4325yMJdRqb3 n73G/qht5bL8exkWNLo2eBx9NPuiqkxabgqXoq/F80WtAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: perf/core: Handle buffer mapping fail correctly in perf_mmap() After successful allocation of a buffer or a successful attachment to an existing buffer perf_mmap() tries to map the buffer read only into the page table. If that fails, the already set up page table entries are zapped, but the other perf specific side effects of that failure are not handled. The calling code just cleans up the VMA and does not invoke perf_mmap_close(). This leaks reference counts, corrupts user->vm accounting and also results in an unbalanced invocation of event::event_mapped(). Cure this by moving the event::event_mapped() invocation before the map_range() call so that on map_range() failure perf_mmap_close() can be invoked without causing an unbalanced event::event_unmapped() call. perf_mmap_close() undoes the reference counts and eventually frees buffers. The Linux kernel CVE team has assigned CVE-2025-38564 to this issue. Affected and fixed versions =========================== Issue introduced in 6.14 with commit b709eb872e19a19607bbb6d2975bc264d59735cf and fixed in 6.15.10 with commit 831e1c90a5d72e6977a57c44f47c46b73a438695 Issue introduced in 6.14 with commit b709eb872e19a19607bbb6d2975bc264d59735cf and fixed in 6.16.1 with commit a9025f73c88d9d6e125743a43afc569da3ce5328 Issue introduced in 6.14 with commit b709eb872e19a19607bbb6d2975bc264d59735cf and fixed in 6.17-rc1 with commit f74b9f4ba63ffdf597aaaa6cad7e284cb8e04820 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-38564 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/831e1c90a5d72e6977a57c44f47c46b73a438695 https://git.kernel.org/stable/c/a9025f73c88d9d6e125743a43afc569da3ce5328 https://git.kernel.org/stable/c/f74b9f4ba63ffdf597aaaa6cad7e284cb8e04820