CVE-2026-138862: mm/mempolicy: use vm_normal_folio_pmd() in queue_folios_pmd()

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

mm/mempolicy: use vmnormalfoliopmd() in queuefoliospmd()

Patch series "mm: stop calling pmdfolio() on special PMDs", v3.

Two page table walkers resolve the folio behind a PMD with pmdfolio(), which is only valid for a PMD mapping a refcounted struct page:

madvisecoldorpageoutpterange() mm/madvise.c queuefoliospmd() mm/mempolicy.c

vmfinsertpfnpmd() installs special PMDs holding a raw pfn that need not have a memmap entry at all. Both walkers can reach one and fault on the first folio field read. The PTE halves of both already use vmnormalfolio(); these two patches make the PMD halves match.

The four callers of vmfinsertpfnpmd(), and which walker each reaches:

drivers/vfio/pci/vfiopcicore.c VMPFNMAP mempolicy drivers/gpu/drm/drmgemshmemhelper.c VMPFNMAP mempolicy drivers/gpu/drm/panthor/panthorgem.c VMPFNMAP mempolicy drivers/hv/mshvvtlmain.c VMMIXEDMAP both

canmadvlruvma() rejects VMPFNMAP, so only mshvvtllow reaches the madvise walker, and that needs CAPSYSADMIN. queuepageswalkops supplies its own ->testwalk, so walkpagetest()'s generic VMPFNMAP skip never runs and vfio-pci is reachable by any process holding the device fd. Hence the different stable tags.

One behaviour change: mbind(MPOLMFSTRICT) over a PMD mapped VMPFNMAP region now returns 0 rather than -EIO. The PTE loop already returned 0 there. drmgemshmem and panthor are where this is observable, since they PMD map pages that do have a memmap entry and so never faulted.

Reproducer ==========

No hardware needed. An out of tree module stands in for the drivers above: three misc devices, each with a ->hugefault calling vmfinsertpfnpmd(), plus VMHUGEPAGE so the fault path takes the PMD branch.

/dev/pmdspecmixed VMMIXEDMAP, pfn at the 1 TiB mark, no memmap /dev/pmdspecpfnmap VMPFNMAP, pfn at the 1 TiB mark, no memmap /dev/pmdspecreal VMPFNMAP, real allocpages(PMDORDER) on node 0

Userspace maps the device into a PMD aligned window, reads one byte to fault the PMD in, checks a module parameter to confirm it went in, then issues the operation.

vng --run <bzImage> --user root --memory 4G --verbose \ --append "numa=fake=2" \ --exec "insmod pmdspec.ko && ./pmdspectest <subtest>"

numa=fake=2 gives a node 1 to bind to; the module allocates its real page on node 0, which is what makes queuefoliorequired() true.

subtest operation parent series -------------------------------------------------------------------- madvcold madvise(MADVCOLD) oops ret=0 madvpageout madvise(MADVPAGEOUT) oops ret=0 mbindmixed mbind(MPOLBIND, n1, MPOLMFMOVE) oops ret=0 mbindpfnmap mbind(MPOLBIND, n1, MPOLMFSTRICT) oops ret=0 mbindreal mbind(MPOLBIND, n1, MPOLMFSTRICT) -EIO ret=0

Two things the table shows that are easy to miss in the code:

- mbindmixed passes only MPOLMFMOVE. MPOLMFSTRICT is not needed for a VMMIXEDMAP vma: walkpagetest() only skips VMPFNMAP, and vmamigratable() is true for VMMIXEDMAP.

- mbindreal demonstrates the user visible change (-EIO -> 0)

This patch (of 2):

mmap a VMPFNMAP region whose ->hugefault installs a PMD through vmfinsertpfnpmd() - a vfio-pci MMIO BAR does this - then

mbind(p, len, MPOLBIND, &mask, maxnode, MPOLMFSTRICT);

With a stand-in module for the driver:

BUG: unable to handle page fault for address: fffff96dc0000008 RIP: 0010:queuefoliospterange+0xaf/0x440 walkpgdrange+0x52b/0xaf0 walkpagerange+0x6a/0x1d0 walkpagerangemmunsafe+0x193/0x230 queuepagesrange+0x64/0xa0 dombind+0x25e/0x640

queuefoliospmd(), inlined above, calls pmdfolio() on that PMD. The pfn is raw MMIO with no memmap entry, so ---truncated---

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:25 PM
Data Sourced
via MITRE·01:25 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203