CVE-2023-52935 mm/khugepaged: fix ->anon_vma race

High 7.8 Published Updated

A race condition in the Linux kernel's huge page management can lead to use-after-free, potentially allowing local attackers to execute code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2023-52935?

CVE-2023-52935 is a high-severity use after free vulnerability in Debian Debian Linux, published on 27 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

mm/khugepaged: fix ->anon_vma race

If an ->anon_vma is attached to the VMA, collapse_and_free_pmd() requires it to be locked.

Page table traversal is allowed under any one of the mmap lock, the anon_vma lock (if the VMA is associated with an anon_vma), and the mapping lock (if the VMA is associated with a mapping); and so to be able to remove page tables, we must hold all three of them. retract_page_tables() bails out if an ->anon_vma is attached, but does this check before holding the mmap lock (as the comment above the check explains).

If we racily merged an existing ->anon_vma (shared with a child process) from a neighboring VMA, subsequent rmap traversals on pages belonging to the child will be able to see the page tables that we are concurrently removing while assuming that nothing else can access them.

Repeat the ->anon_vma check once we hold the mmap lock to ensure that there really is no concurrent page table access.

Hitting this bug causes a lockdep warning in collapse_and_free_pmd(), in the line "lockdep_assert_held_write(&vma->anon_vma->root->rwsem)". It can also lead to use-after-free access.

Weakness: CWE-416

Which versions are affected by CVE-2023-52935?

It affects 2 products.

Products include Debian Debian Linux, Linux kernel.

How do I fix CVE-2023-52935?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2023-52935 being exploited?

There is no known exploitation of CVE-2023-52935 in the wild and no public exploit code.

All Debian Debian Linux vulnerabilities

Sources

Also known as AZL-59411, BELL-CVE-2023-52935, DEBIAN-CVE-2023-52935, GHSA-whcm-px77-62x7, ROOT-OS-DEBIAN-11-CVE-2023-52935, ROOT-OS-UBUNTU-2204-CVE-2023-52935 and 1 more.

Is CVE-2023-52935 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free