REDHAT-BUG-2577753: High severity Linux Linux kernel vulnerability

Published Nov 20, 2026
·
Updated

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

mm/userfaultfd: only allocate anonvma in CoW mappings

findvmaandprepareanon() can end up allocating an anonvma in VMAs that are not CoW mappings, which is wrong.

If we have a MAPSHARED R/O file mapped, we lack VMSHARED (but do have VMMAYSHARE) and lack VMMAYWRITE.

While uffd later rejects such mappings (uffd registration requires VMMAYWRITE, see comment in validatedstvma) findvmaandprepareanon() still wrongly allocates an anon vma before it validates the vma.

This in turn later confuses copypagerange()->vmaneedscopy() such that we end up calling copyhugetlbpagerange() with ranges that actually do not contain any per-pagetable information that would require copying, which is the basis for PMD-table sharing in the first place.

copyhugetlbpagerange() should not have to worry about shared PMD tables at all: it doesn't make any sense to copy page tables that are shared, as they can be fully recreated later. Ending up in the function with shareable page tables is the real issue.

If a destination PMD table is shared in copyhugetlbpagerange(), it might get concurrently unshared as we are not holding relevant locks, resulting in us using a page table that is no longer mapped and possibly freed after calling:

dstpte = hugeptealloc(dst, dstvma, addr, sz);

To fix it, do not allocate an anonvma in non-CoW mappings and add a safety guard to copyhugetlbpagerange(), making sure that we never end up messing with shared PMD tables in there.

Before commit 867a43a34ff8a ("userfaultfd: use per-vma locks in userfaultfd operations") we would always validate the VMA before allocating an anonvma, and consequently never wrongly allocate an anonvma.

As uffdlockvma() is part of the same lookup machinery and also contains a misleading VMSHARED check, change that one as well directly for consistency.

A follow-up cleanup will stop taking the hugetlbvmalockread(srcvma) lock in copyhugetlbpagerange() entirely. Further, the usage of VMSHARED in userfaultfd code should be cleaned up later to focus on CoW vs. non-CoW mappings.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 20, 2026
Data Sourced
via Red Hat·06:11 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Are read-only shared file mappings relevant to this issue?

Yes. The described problematic case is a MAP_SHARED read-only file mapping that has VM_MAYSHARE but lacks VM_SHARED and VM_MAYWRITE.

2

Can the affected mapping be registered with userfaultfd?

No. Later userfaultfd validation rejects these mappings because registration requires VM_MAYWRITE. However, an anon_vma may already have been allocated before that validation occurs.

3

What makes the condition unsafe after the incorrect allocation?

The allocation can cause copy_page_range() to treat the VMA as needing copying and invoke copy_hugetlb_page_range() for shareable PMD tables. A destination PMD table may then be concurrently unshared while that function is operating on it.

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