CVE-2025-39754: mm/smaps: fix race between smaps_hugetlb_range and migration
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mm/smaps: fix race between smaps_hugetlb_range and migration
smaps_hugetlb_range() handles the pte without holdling ptl, and may be concurrenct with migration, leaing to BUG_ON in pfn_swap_entry_to_page(). The race is as follows.
smaps_hugetlb_range migrate_pages
huge_ptep_get
remove_migration_ptes folio_unlock
pfn_swap_entry_folio
BUG_ON
To fix it, hold ptl lock in smaps_hugetlb_range().
The Linux kernel CVE team has assigned CVE-2025-39754 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.4 with commit 25ee01a2fca02dfb5a3ce316e77910c468108199 and fixed in 6.12.43 with commit 2a1f3663974162b8f1e098196f557cfc1d160138 Issue introduced in 4.4 with commit 25ee01a2fca02dfb5a3ce316e77910c468108199 and fixed in 6.15.11 with commit 09fc018f48871123ad5dbd7b03c956580232ed76 Issue introduced in 4.4 with commit 25ee01a2fca02dfb5a3ce316e77910c468108199 and fixed in 6.16.2 with commit b625883ccbcc2b57808db51d1375b1d7b9bcb3e5 Issue introduced in 4.4 with commit 25ee01a2fca02dfb5a3ce316e77910c468108199 and fixed in 6.17-rc2 with commit 45d19b4b6c2d422771c29b83462d84afcbb33f01
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-39754
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:
fs/proc/task_mmu.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/2a1f3663974162b8f1e098196f557cfc1d160138 https://git.kernel.org/stable/c/09fc018f48871123ad5dbd7b03c956580232ed76 https://git.kernel.org/stable/c/b625883ccbcc2b57808db51d1375b1d7b9bcb3e5 https://git.kernel.org/stable/c/45d19b4b6c2d422771c29b83462d84afcbb33f01