PT-2026-104926 · Azure Linux · Kernel

Published

2026-09-24

·

Updated

2026-09-24

None

No severity ratings or metrics are available. When they are, we'll update the corresponding info on the page.
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 RLIMIT MEMLOCK 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 AS UNEVICTABLE, not PG mlocked.
A user can therefore easily work around the RLIMIT MEMLOCK 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 io uring, perf, skbuff, iommufd and xdp by tracking the number of locked pages in user struct->locked vm.
Since the scope tracked is actually inode lifetime, the RLIMIT MEMLOCK applies per-user not per-process, so it doesn't make sense to bypass for users with CAP IPC LOCK, 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.
secretmem account pages() is more or less a duplicate of the code that io uring etc. use, but since this is a bug fix that needs backporting, defer any de-duplication efforts to a follow-up.
test mlock limit() asserts mlock future ok() on mmap(), however this has been removed, so remove the test altogether for the fix. A new test will be sent separately for upstream.
Found an issue in the description? Have something to add? Feel free to write us 👾

Related Identifiers

AZL-103787

Affected Products

Kernel