CVE-2026-97533: x86/mm/pat: Acquire init_mm read lock on attribute changes to avoid UAF

Published Sep 25, 2026
·
Updated

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

x86/mm/pat: Acquire initmm read lock on attribute changes to avoid UAF

A previous commit protected against races between ptdump and CPA collapse, however one still exists between attribute changes and collapse as reported by Denis V. Lunev (linked).

When an attribute change arises, a lockless page table walker obtains a PTE entry, which is later written to via setpteatomic():

... -> changepageattrsetclr() -> changepageattrsetclr() -> changepageattr() -> lookupaddresscpa() -> lookupaddressinpgdattr() -> [ lockless page table walker ] -> setpteatomic()

There is nothing preventing a concurrent CPA collapse which can free the PTE that was retrieved here, resulting in a use-after-free.

With the mmap write lock taken on initmm over CPA collapse, resolve this race by acquiring an mmap read lock on initmm over changepageattrsetclr().

This locks across the whole operation over which the walk and the PTE entry write occurs, solving the race.

It is safe to do this here, as no spinlocks are held upon entry to changepageattrsetclr().

However, the lock must not be held over an allocation, as allocation can trigger reclaim and shrinkers may call into CPA recursively, making deadlocks possible (initmm -> ... -> fsreclaim -> initmm).

A page table is allocated when a huge page needs to be split:

-> changepageattrsetclr() -> changepageattrsetclr() -> changepageattr() -> splitlargepage() [ pagetablealloc() ] -> splitlargepage()

Avoid deadlocks by dropping the mmap lock across pagetablealloc() in splitlargepage() and track whether this is needed by adding a new 'initmmreadlocked' flag to struct cpadata.

This is safe as splitlargepage() (called with locks re-established) revalidates that the page table entry is the same as it was prior to the locks being dropped and changepageattr() repeats the entire page table walk whenever a split occurs, so concurrent split and collapse are accounted for.

Concurrent ptdump is also safe as the lock is only dropped over page table allocation during which time the page table has not yet been modified.

The CPACOLLAPSE flag is only set by setmemoryrox(), which exclusively operates upon vmalloc ranges, and on x86 only within the module mapping space.

This is important, because some callers directly invoke changepageattrsetclr(), bypassing this lock. However, none of these operate within the module mapping space.

cpaprocessalias() - a recursive helper called by changepageattrsetclr(). setmemoryencpgtable() - operates on the direct mapping and (via vmbusestablishgpadl()) the vmalloc mapping space. setpages[n]p() - called by setdirectmap[invalid, default, valid]noflush(), kernelmappages() - operates on the direct map. kernel[un]mappagesinpgd() - operates on EFI ranges.

This work is based upon Denis V. Lunev's excellent analysis of the bug with gratitude.

[ dhansen: move to imperative voice in changelog ]

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    Acquire an mmap read lock on init_mm across page-table attribute changes and an mmap write lock on init_mm across CPA collapse operations, including revalidating the PTE after the lockless page-table walk before writing it with set_pte_atomic().

Event History

Sep 25, 2026
CVE Published
via MITRE·10:21 AM
Data Sourced
via MITRE·10:21 AM
Description
Data Sourced
via NVD·11:17 AM
Description

Frequently Asked Questions

1

What condition triggers the use-after-free race?

The race requires an x86 page-attribute change to occur concurrently with a CPA collapse. A lockless page-table walk can retain a PTE pointer that the concurrent collapse then frees before set_pte_atomic() writes through it.

2

What code path is involved?

The affected attribute-change path reaches _lookup_address_cpa() and lookup_address_in_pgd_attr(), performs a lockless page-table walk, and later calls set_pte_atomic(). The vulnerable interval is between retrieving the PTE entry and writing it.

3

How is the race resolved?

The fix acquires the init_mm mmap read lock across __change_page_attr_set_clr(), covering both the page-table walk and the subsequent PTE write. CPA collapse holds the init_mm mmap write lock, so the two operations can no longer race.

4

Are there stable fix references available?

Yes. The provided stable references are e21a9ea81426a85fdb0cdcfcc99d5d9c16b402ab, cc73b2043d106b467accd38e9b1fc09e0607c056, and d5d8b8662e6e5a565b47a0388640e88402f23274.

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