CVE-2025-38242

linux: In the Linux kernel, the following vulnerability has been resolved: mm: userfaultfd: fix race of userfaultfd_move an...

CVE-2025-38242 is fixed in 70 products on 1 platform, first by DEBIAN-CVE-2025-38242, released July 9, 2025. It is not reported as exploited. Patch Radar priority: Routine.

Routine
CVSS
5.5
medium
Exploitation
None reported
No vendor assessment
CISA KEV
Not listed
Not in the Known Exploited Vulnerabilities catalog
EPSS
0.0013
2nd percentile

In the Linux kernel, the following vulnerability has been resolved: mm: userfaultfd: fix race of userfaultfd_move and swap cache This commit fixes two kinds of races, they may have different results: Barry reported a BUG_ON in commit c50f8e6053b0, we may see the same BUG_ON if the filemap lookup returned NULL and folio is added to swap cache after that. If another kind of race is triggered (folio changed after lookup) we may see RSS counter is corrupted: [ 406.893936] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0 type:MM_ANONPAGES val:-1 [ 406.894071] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0 type:MM_SHMEMPAGES val:1 Because the folio is being accounted to the wrong VMA. I'm not sure if there will be any data corruption though, seems no. The issues above are critical already. On seeing a swap entry PTE, userfaultfd_move does a lockless swap cache lookup, and tries to move the found folio to the faulting vma. Currently, it relies on checking the PTE value to ensure that the moved folio still belongs to the src swap entry and that no new folio has been added to the swap cache, which turns out to be unreliable. While working and reviewing the swap table series with Barry, following existing races are observed and reproduced [1]: In the example below, move_pages_pte is moving src_pte to dst_pte, where src_pte is a swap entry PTE holding swap entry S1, and S1 is not in the swap cache: CPU1 CPU2 userfaultfd_move move_pages_pte() entry = pte_to_swp_entry(orig_src_pte); // Here it got entry = S1 ... < interrupted> ... <swapin src_pte, alloc and use folio A> // folio A is a new allocated folio // and get installed into src_pte <frees swap entry S1> // src_pte now points to folio A, S1 // has swap count == 0, it can be freed // by folio_swap_swap or swap // allocator's reclaim. <try to swap out another folio B> // folio B is a folio in another VMA. <put folio B to swap cache using S1 > // S1 is freed, folio B can use it // for swap out with no problem. ... folio = filemap_get_folio(S1) // Got folio B here !!! ... < interrupted again> ... <swapin folio B and free S1> // Now S1 is free to be used again. <swapout src_pte & folio A using S1> // Now src_pte is a swap entry PTE // holding S1 again. folio_trylock(folio) move_swap_pte double_pt_lock is_pte_pages_stable // Check passed because src_pte == S1 folio_move_anon_rmap(...) // Moved invalid folio B here !!! The race window is very short and requires multiple collisions of multiple rare events, so it's very unlikely to happen, but with a deliberately constructed reproducer and increased time window, it can be reproduced easily. This can be fixed by checking if the folio returned by filemap is the valid swap cache folio after acquiring the folio lock. Another similar race is possible: filemap_get_folio may return NULL, but folio (A) could be swapped in and then swapped out again using the same swap entry after the lookup. In such a case, folio (A) may remain in the swap cache, so it must be moved too: CPU1 CPU2 userfaultfd_move move_pages_pte() entry = pte_to_swp_entry(orig_src_pte); // Here it got entry = S1, and S1 is not in swap cache folio = filemap_get ---truncated---

Where it's fixed

ProductFixed inFixReleased
Linux
bpftool6.12 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
bpftool6.12-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
dtb-aarch64 · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-64kb · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-64kb · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-default · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-default · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-default-base · opensuse-leap 16.0 6.12.0-160000.6.1.160000.2.4 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-default-base · sles 16.0 6.12.0-160000.6.1.160000.2.4 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-docs · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-docs · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-kvmsmall · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-kvmsmall · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-livepatch-6.12.37-61.105 · amzn 2023 1:1.0-0.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel-obs-build · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-obs-qa · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-obs-qa · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-rt · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-source · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-source · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-syms · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-syms · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel-uek · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-devel · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-devel · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-deprecated · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-deprecated · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-desktop · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-desktop · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-extra · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-extra · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-extra-netfilter · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-extra-netfilter · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-usb · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-usb · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-wireless · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-debug-modules-wireless · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-devel · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-devel · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-doc · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-doc · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-deprecated · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-deprecated · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-desktop · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-desktop · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-extra · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-extra · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-extra-netfilter · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-extra-netfilter · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-usb · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-usb · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-wireless · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-modules-wireless · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-tools · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek-tools · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-devel · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-devel · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-core · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-core · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-deprecated · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-deprecated · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-desktop · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-desktop · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-extra · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-extra · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-extra-netfilter · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-extra-netfilter · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-usb · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-usb · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-wireless · ol 10 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-uek64k-modules-wireless · ol 9 0:6.12.0-103.40.4.1.el9uek ELSA-2025-20551 Sep 8, 2025
kernel-zfcpdump · opensuse-leap 16.0 6.12.0-160000.6.1 OPENSUSE-SU-2025:20081-1 Nov 25, 2025
kernel-zfcpdump · sles 16.0 6.12.0-160000.6.1 SUSE-SU-2025:21139-1 Nov 25, 2025
kernel6.12 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-debuginfo-common-aarch64 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-debuginfo-common-x86_64 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-devel · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-headers · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-libbpf · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-libbpf-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-libbpf-devel · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-libbpf-static · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-modules-extra · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-modules-extra-common · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-tools · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-tools-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
kernel6.12-tools-devel · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
linux · Debian 13.5 (trixie) 6.12.37-1 DEBIAN-CVE-2025-38242 Jul 9, 2025
linux · Debian 14 6.12.37-1 DEBIAN-CVE-2025-38242 Jul 9, 2025
perf6.12 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
perf6.12-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
python3-perf6.12 · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025
python3-perf6.12-debuginfo · amzn 2023 1:6.12.37-61.105.amzn2023 ALAS2023-2025-1130 Jul 29, 2025

Patch Radar data is free to use with attribution. Terms and how to credit it.

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.