CVE-2026-93243: mm/secretmem: properly account locked pages
In the Linux kernel, the following vulnerability has been resolved:
mm/secretmem: properly account locked pages
secretmem accounts folios by treating memory as if it were mlock()'d and thus limited by the RLIMITMEMLOCK limit.
However the folios are unevictable and remain so until the inode is evicted, eliminating usual mlock() semantics - mapping folios then unmapping them does not clear their unevictable state, since it depends on ASUNEVICTABLE, not PGmlocked.
A user can therefore easily work around the RLIMITMEMLOCK limit - simply map then unmap and VmLck no longer counts the secretmem range. Worse, folios are not accounted in the process's RSS, meaning the OOM killer won't know to kill the process.
Repeatedly mapping/unmapping (or forking) can then result in the consumption of all available system memory with unevictable folios and cause system instability.
A secretmem fd can be passed between processes and over fork so a per-process limit simply does not make sense, so follow the precedent set by iouring, perf, skbuff, iommufd and xdp by tracking the number of locked pages in userstruct->lockedvm.
Since the scope tracked is actually inode lifetime, the RLIMITMEMLOCK applies per-user not per-process, so it doesn't make sense to bypass for users with CAPIPCLOCK, therefore remove this bypass.
There is simply no reason to carry on marking the mapping as mlock()'d since it's misleading and the lifecycle is now correctly handled, so remove this too.
Note that secretmem does not support any form of truncation (including hole punching) and the folios are unreclaimable, so the folios need only be accounted on fault and unaccounted on inode destruction.
secretmemaccountpages() is more or less a duplicate of the code that iouring etc. use, but since this is a bug fix that needs backporting, defer any de-duplication efforts to a follow-up.
testmlocklimit() asserts mlockfutureok() on mmap(), however this has been removed, so remove the test altogether for the fix. A new test will be sent separately for upstream.
Affected Software
Event History
Frequently Asked Questions
Who can realistically trigger this issue?
A local user or process able to use secretmem can trigger it. The issue can also span processes because a secretmem file descriptor can be passed between processes and inherited across fork.
What does an attacker need to do to cause impact?
They need to repeatedly map and unmap secretmem memory, or fork processes holding secretmem mappings. This can bypass the intended RLIMIT_MEMLOCK restriction and accumulate unevictable memory.
What is the practical impact on a host?
Available system memory can be consumed by unevictable folios while the affected memory is not accounted in the process RSS. The OOM killer may therefore not select the responsible process, potentially causing system instability.
Does a per-process RLIMIT_MEMLOCK limit adequately contain this behavior?
No. Mapping and then unmapping can make the secretmem range no longer count in VmLck, and secretmem file descriptors can be shared or inherited, so a per-process limit does not match the lifetime of the allocated memory.