CVE-2026-99920: mm/mlock: use a long for the page count in mlock_fixup()

Published Nov 30, 2026
·
Updated

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

mm/mlock: use a long for the page count in mlockfixup()

mlockfixup() adjusts mm->lockedvm, an unsigned long, by the number of pages whose VMLOCKED state it changes, but computes that number in an int:

int nrpages; ... nrpages = (end - start) >> PAGESHIFT; ... mm->lockedvm += nrpages;

When a single VMA range of 2^31 pages (8 TiB with 4 KiB pages) or more is locked or unlocked, the count is truncated to 32 bits and then sign-extended, so lockedvm is changed by the wrong amount, while munmap(), mremap() and the other paths that maintain lockedvm use the full unsigned long page count.

Such a range is reachable on 64-bit architectures with a 47-bit or larger user address space (x8664, arm64 with 48-bit VA, riscv64 Sv48) by a task with CAPIPCLOCK or a raised RLIMITMEMLOCK, which domlock() checks against the full untruncated length. It costs nothing with MAPNORESERVE and MLOCKONFAULT/MCLONFAULT, since then no page is populated. On x8664, after

p = mmap(NULL, 8UL << 40, PROTREAD | PROTWRITE, MAPPRIVATE | MAPANONYMOUS | MAPNORESERVE, -1, 0); mlock2(p, 8UL << 40, MLOCKONFAULT);

VmLck in /proc/self/status reads 18446744065119617024 kB instead of 8589934592 kB; munmap() of the region then subtracts the true size and leaves VmLck at 18446744056529682432 kB instead of 0. With 16 TiB, lockedvm is not changed at all, VmLck stays 0 kB, and after the task drops CAPIPCLOCK or lowers RLIMITMEMLOCK, mlock(), mmap(MAPLOCKED) and the other mlockfutureok() and accountlockedvm() users enforce RLIMITMEMLOCK against that count, so they let the task lock memory beyond its limit (or, in the 8 TiB case, refuse every further lock). The error persists for the life of the mm; unlocking the range in pieces skews it further. The wrong count is per-mm accounting only: it does not change which pages are locked.

The int has been there since before git history (the variable was named "pages" until it was renamed in 2.6.28); every other updater of lockedvm uses an unsigned long or long count. Make nrpages a long, which holds the page count of any user range and its negation, so the existing sign handling is unchanged.

Found by formal verification of mm/mlock.c against the kernel binary.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:18 PM
Data Sourced
via MITRE·01:18 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