HIGH Introduced in 6.19
mempolicy QueueFolios Deref
CVE-2026-89758
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.7HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: mm/mempolicy: skip non-present PMDs when queueing folios Patch series "mm: handle device-private PMDs in walk callbacks", v3. Since commit 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations") a PMD may hold a device-private swap entry whenever an HMM-based GPU driver migrates an anonymous THP folio to device memory via migrate_vma_pages(). pmd_trans_huge_lock() succeeds for such PMDs (pmd_is_huge() returns true for any non-present, non-none huge PMD), so several MM walk callbacks that used to assume present THP or migration entry are now reachable with a device-private PMD. The results range from a VM_BUG_ON() firing on debug kernels, to an oops on a bogus vmemmap dereference, to silently isolating an unrelated live folio from LRU in the aliasing case. This patch (of 3): queue_folios_pmd() is called under pmd_trans_huge_lock(), whose pmd_is_huge() check returns true for any non-present, non-none PMD softleaf. Passing such a PMD to pmd_folio() treats the softleaf encoding as a hardware PFN and can return a bogus folio pointer. Mirror queue_folios_pte_range(): handle non-present entries before looking up a folio. Keep migration entries counted as failures, but skip other non-present PMDs such as device-private entries. Potential trigger: an HMM-based GPU driver migrates an anonymous THP folio to device memory via migrate_vma_pages(), leaving a device-private PMD. Userspace then calls mbind(), migrate_pages() or set_mempolicy_home_node() on that range.
02KernelScan AI Analysis
Risk summary
A local user with access to an HMM-based GPU can trigger kernel memory corruption by migrating a transparent huge page to device memory and then invoking a NUMA memory-policy syscall on that range. The kernel misinterprets the device-private PMD entry as a physical page frame number, producing a bogus folio pointer whose dereference can crash the system or silently corrupt the state of an unrelated page. Systems without HMM-based GPU hardware are not affected.
Vulnerability analysis
When an HMM-based GPU driver migrates an anonymous transparent huge page to device memory, the corresponding PMD entry becomes a device-private swap entry. The mempolicy code that queues folios for NUMA migration or policy enforcement only checked for migration-entry PMDs and assumed everything else was a present huge page. Passing a device-private PMD to the folio lookup function treated the swap-entry bit encoding as a hardware page-frame number, yielding a bogus folio pointer. Subsequent operations on that pointer could fire a kernel assertion, dereference invalid vmemmap memory causing an oops, or silently isolate an unrelated live page from the LRU list. The fix adds a present-PMD check before the folio lookup: migration entries are still counted as failures, while other non-present PMDs such as device-private entries are simply skipped. Any local user can trigger this by first migrating a huge page to a GPU via the HMM driver and then calling mbind(), migrate_pages(), or set_mempolicy_home_node() on that address range; no special privileges are needed, though an HMM-capable GPU must be present.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 7.2 | 6.19 | 7.2.4 | 3d927093b2ad |
| mainline | 6.19 | 7.3 | 2858b4027f49 |