CVE-2026-139657: mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()
In the Linux kernel, the following vulnerability has been resolved:
mm/gup: honour FOLLPIN in NOMMU getuserpageslocked()
The !CONFIGMMU implementation of getuserpageslocked() takes a bare getpage() reference for each page regardless of follflags: if (pages[i]) getpage(pages[i]);
This is reached from pinuserpages() with FOLLPIN set. unpinuserpage() is shared between MMU and NOMMU configurations and unconditionally calls gupputfolio(..., FOLLPIN), which subtracts GUPPINCOUNTINGBIAS (1024) from the folio refcount.
This means that pin adds 1, and then unpin will subtract 1024.
If a user maps a page (refcount 1), registers it 1023 times as an iouring fixed buffer (1023 pinuserpages calls -> refcount 1024), then unregisters: the first unpinuserpage subtracts 1024, refcount hits 0, the page is freed and returned to the buddy allocator. The remaining 1022 unpins write into whatever was reallocated, and the user's VMA still maps the freed page (NOMMU has no MMU to invalidate it). Reallocating the page for an iouring pbufring then lets userspace corrupt the new owner's data through the stale mapping.
Use trygrabfolio() which adds GUPPINCOUNTINGBIAS for FOLLPIN and 1 for FOLLGET, mirroring the CONFIGMMU path so pin and unpin are symmetric. Keep supporting the traditional behavior where users specify a pages array but don't set FOLLGET.
While at it, don't return NULL pointers in the page array, as this is really not expected for GUP users; instead, just fail and return -EFAULT.
[ david: support traditional behavior with no FOLLGET, extend description ]
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
The affected path is the !CONFIG_MMU implementation of __get_user_pages_locked(), so exposure is limited to Linux kernel builds without MMU support. The described exploitation sequence also uses io_uring fixed-buffer registration and an io_uring pbuf_ring allocation.
What conditions are needed to trigger the memory corruption?
A user needs to map a page, register it 1023 times as an io_uring fixed buffer, and then unregister those buffers. After the first unpin frees the page, reallocating it for an io_uring pbuf_ring can allow writes through the still-mapped stale page to corrupt the new owner's data.