CVE-2026-139786: mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows

Published Nov 30, 2026
·
Updated

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

mm/vma: avoid spurious write locks when mm->mmlockseq overflows

So far the assumption has been that mm->mmlockseq overflow is benign, resulting only in readers spuriously falling back to the mmap lock, however it turns out that this was an unsafe assumption.

If a VMA can be spuriously considered write locked that means read lock exclusion does not take place, and thus a VMA can end up write-locked with concurrent readers.

Since overflow only occurs every 2^31 write lock/unlock cycles, resolve the issue by resetting every VMA's vma->vmlockseq each time such an overflow occurs.

This is done in vmaendwriteall(), which is called when the mmap write lock is released, i.e. in mmapwriteunlock() and mmapwritedowngrade().

Care must be taken, as resetting the sequence count at overflow means changing the seqcount of VMAs which are already attached and observable.

The mm's seqcount is guaranteed to be odd when a write lock is held, and thus any write locked VMA will have an odd seqcount assigned.

Therefore resetting to an even value prevents spurious write locks, since these can only occur with the mmap write lock held, at which point the mmap seqcount will be odd.

However, vmastartread() also checks vma->vmlockseq == mm->mmlockseq, bailing if so (indicating a write lock).

This would cause any even reset value chosen to prevent VMA read locks from being taken - avoid this by also checking whether the VMA seqcount is odd before bailing on the read lock.

So far, vma->vmlockseq has defaulted to UINTMAX, but this has been unnecessary since commit e5e7fb278e59 ("mm: convert mmlockseq to a proper seqcount"), since this is assigned when the VMA is still detached, and cannot be observed.

Therefore perform both reset and initialisation of vma->vmlockseq by simply setting vma->vmlockseq to zero.

The reset, performed in mmresetvmaseqcounts(), only needs to WRITEONCE() the value.

However the read of vma->vmlockseq in vmastartread() needs to have acquire semantics to pair with the smpwmb() in dorawwriteseqcountend() so a reader reading a reset value also observes VMA modifications made under the write lock.

Since all VMA write locks were just released and the mmap write lock is still held, there are no concurrent VMA writers.

Concurrent VMA readers are unaffected. New VMA readers observe either zero, never a write lock, or the prior seqcount, behaving as before the reset.

Since this only occurs every 2^31 write lock/unlock cycles, the time taken to update all VMAs is considered to be acceptable.

Also update comments, documentation and VMA userland tests to reflect the change.

User facing effects are - dangerous races that could cause memory corruption or NULL pointer derefences (especially on page table traversal) are avoided.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:37 PM
Data Sourced
via MITRE·01:37 PM
Description

Frequently Asked Questions

1

When can this issue be triggered?

It requires mm->mm_lock_seq to overflow, which occurs only after 2^31 VMA write lock/unlock cycles. The overflow can cause a VMA to be spuriously treated as write locked.

2

What is the impact of a spurious write-lock state?

Read-lock exclusion may not occur, allowing a VMA to be write locked while readers access it concurrently. The description identifies this as unsafe rather than merely causing readers to fall back to the mmap lock.

3

How is the issue addressed?

On sequence-counter overflow, the fix resets every VMA's vm_lock_seq in vma_end_write_all(). This occurs when the mmap write lock is released or downgraded, through mmap_write_unlock() and mmap_write_downgrade().

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