CVE-2026-139657
published high CVSS 3.1 · 7.8mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < d557cd126601a73a8756b0b18e1aadfb702df67b · 3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < 47f5b21856845382e6e0f4b74e6f93165e1f49bc · 3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < 4dc46f3c9a44bd1a6ab41d7626abb0992283afb4 · 3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < da01399b90a73cd00b502f7903fa5acbfac4a103 · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux5.7 (affected) · 0 to < 5.7 (unaffected · semver) · 6.12.120 through 6.12.* (unaffected · semver) · 6.18.65 through 6.18.* (unaffected · semver) · 7.3.6 through 7.3.* (unaffected · semver) · 7.4-rc1 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
| Amazon Linux | AL2 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
| Amazon Linux | AL2023 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
Description
In the Linux kernel, the following vulnerability has been resolved: mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked() The !CONFIG_MMU implementation of __get_user_pages_locked() takes a bare get_page() reference for each page regardless of foll_flags: if (pages[i]) get_page(pages[i]); This is reached from pin_user_pages*() with FOLL_PIN set. unpin_user_page() is shared between MMU and NOMMU configurations and unconditionally calls gup_put_folio(..., FOLL_PIN), which subtracts GUP_PIN_COUNTING_BIAS (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 io_uring fixed buffer (1023 pin_user_pages calls -> refcount 1024), then unregisters: the first unpin_user_page 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 io_uring pbuf_ring then lets userspace corrupt the new owner's data through the stale mapping. Use try_grab_folio() which adds GUP_PIN_COUNTING_BIAS for FOLL_PIN and 1 for FOLL_GET, mirroring the CONFIG_MMU path so pin and unpin are symmetric. Keep supporting the traditional behavior where users specify a pages array but don't set FOLL_GET. 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 FOLL_GET, extend description ]
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - Reached by io_uring_register(IORING_REGISTER_BUFFERS) → io_sqe_buffer_register() → io_pin_pages() → pin_user_pages_fast() → gup_fast_fallback() → __gup_longterm_locked() → the NOMMU __get_user_pages_locked() the fix patched. The pinned page and the iovecs are the caller's own memory, and no remote protocol supplies them. AC:L - On CONFIG_MMU=n (forced by CPU_V7M and RISCV_M_MODE), do_mmap_private() gives anonymous memory as order-0 alloc_pages_exact() pages with refcount 1. 1023 iovecs on one page raise it to 1024 (+1 each via get_page), and replacing one slot with IORING_REGISTER_BUFFERS_UPDATE unpins it by 1024 to zero. That is deterministic and fits the 8 MiB RLIMIT_MEMLOCK. PR:L - io_uring_setup()/io_uring_register() need no capability (io_uring_disabled defaults to 0). Without CAP_IPC_LOCK, io_buffer_account_pin() only charges 1023 order-0 pages against the user's RLIMIT_MEMLOCK, so any local unprivileged user qualifies. UI:N - The attacker maps, registers and replaces buffers in their own process. No other user mounts, opens or runs anything. S:U - The freed page comes back from the kernel's own buddy allocator and goes to kernel owners within the same authority. No hypervisor or IOMMU boundary is crossed. C:H - After the free, the other 1022 slots keep imu->bvec pointing at the page. IORING_OP_WRITE_FIXED via io_import_reg_buf() copies whatever kernel object reallocated it out to an attacker-readable file, an unbounded page-sized read. I:H - IORING_OP_READ_FIXED writes attacker file data into the reallocated page through those stale bvecs. Each remaining unpin_user_folio() subtracts 1024 from the new owner's refcount, and free_page_series() at munmap drops another ref. That lets the attacker free kernel-owned pages early, a page-level UAF write primitive. A:H - The refcount underflow on reallocated pages and the double free via free_page_series() corrupt buddy-allocator state and oops or panic the kernel. Even benign pinned I/O (io_uring fixed buffers, O_DIRECT bio_release_pages) drives the refcount negative and leaks the page permanently.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < d557cd126601a73a8756b0b18e1aadfb702df67b (affected · git)3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < 47f5b21856845382e6e0f4b74e6f93165e1f49bc (affected · git)3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < 4dc46f3c9a44bd1a6ab41d7626abb0992283afb4 (affected · git)3faa52c03f440d1b9ddef18c4f189f4790d52d7e to < da01399b90a73cd00b502f7903fa5acbfac4a103 (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 5.7 (affected)0 to < 5.7 (unaffected · semver)6.12.120 through 6.12.* (unaffected · semver)6.18.65 through 6.18.* (unaffected · semver)7.3.6 through 7.3.* (unaffected · semver)7.4-rc1 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
4Provider assertions
1Linux · cna
mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- ec4623135ae5c020fe43c3379bf6525ef6a89dd0c90d9b84124916dd82e41539
- Ingested
- 01 Dec 2026, 05:47:22 UTC
- Source record
- Official CVE record