# CVE-2023-52934: mm/MADV\_COLLAPSE: catch !none !huge !bad pmd lookups

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 5, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-03-27T16:37:14.857Z
- **Modified:** 2026-08-05T09:12:08.975Z

## Who should check

- Anyone running Linux \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< 96aaaf8666010a39430cecf8a65c7ce2908a030f; \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< edb5d0cf5525357652aff6eacd9850b8ced07143
- Anyone running Linux 6.1

## Description

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

mm/MADV\_COLLAPSE: catch !none !huge !bad pmd lookups

In commit 34488399fa08 ("mm/madvise: add file and shmem support to
MADV\_COLLAPSE") we make the following change to find\_pmd\_or\_thp\_or\_none():

	-       if (!pmd\_present(pmde))
	-               return SCAN\_PMD\_NULL;
	+       if (pmd\_none(pmde))
	+               return SCAN\_PMD\_NONE;

This was for-use by MADV\_COLLAPSE file/shmem codepaths, where
MADV\_COLLAPSE might identify a pte-mapped hugepage, only to have
khugepaged race-in, free the pte table, and clear the pmd.  Such codepaths
include:

A) If we find a suitably-aligned compound page of order HPAGE\_PMD\_ORDER
   already in the pagecache.
B) In retract\_page\_tables(), if we fail to grab mmap\_lock for the target
   mm/address.

In these cases, collapse\_pte\_mapped\_thp() really does expect a none (not
just !present) pmd, and we want to suitably identify that case separate
from the case where no pmd is found, or it's a bad-pmd (of course, many
things could happen once we drop mmap\_lock, and the pmd could plausibly
undergo multiple transitions due to intervening fault, split, etc). 
Regardless, the code is prepared install a huge-pmd only when the existing
pmd entry is either a genuine pte-table-mapping-pmd, or the none-pmd.

However, the commit introduces a logical hole; namely, that we've allowed
!none- && !huge- && !bad-pmds to be classified as genuine
pte-table-mapping-pmds.  One such example that could leak through are swap
entries.  The pmd values aren't checked again before use in
pte\_offset\_map\_lock(), which is expecting nothing less than a genuine
pte-table-mapping-pmd.

We want to put back the !pmd\_present() check (below the pmd\_none() check),
but need to be careful to deal with subtleties in pmd transitions and
treatments by various arch.

The issue is that \_\_split\_huge\_pmd\_locked() temporarily clears the present
bit (or otherwise marks the entry as invalid), but pmd\_present() and
pmd\_trans\_huge() still need to return true while the pmd is in this
transitory state.  For example, x86's pmd\_present() also checks the
\_PAGE\_PSE , riscv's version also checks the \_PAGE\_LEAF bit, and arm64 also
checks a PMD\_PRESENT\_INVALID bit.

Covering all 4 cases for x86 (all checks done on the same pmd value):

1) pmd\_present() && pmd\_trans\_huge()
   All we actually know here is that the PSE bit is set. Either:
   a) We aren't racing with \_\_split\_huge\_page(), and PRESENT or PROTNONE
      is set.
      =\> huge-pmd
   b) We are currently racing with \_\_split\_huge\_page().  The danger here
      is that we proceed as-if we have a huge-pmd, but really we are
      looking at a pte-mapping-pmd.  So, what is the risk of this
      danger?

      The only relevant path is:

	madvise\_collapse() -\> collapse\_pte\_mapped\_thp()

      Where we might just incorrectly report back "success", when really
      the memory isn't pmd-backed.  This is fine, since split could
      happen immediately after (actually) successful madvise\_collapse().
      So, it should be safe to just assume huge-pmd here.

2) pmd\_present() && !pmd\_trans\_huge()
   Either:
   a) PSE not set and either PRESENT or PROTNONE is.
      =\> pte-table-mapping pmd (or PROT\_NONE)
   b) devmap.  This routine can be called immediately after
      unlocking/locking mmap\_lock -- or called with no locks held (see
      khugepaged\_scan\_mm\_slot()), so previous VMA checks have since been
      invalidated.

3) !pmd\_present() && pmd\_trans\_huge()
  Not possible.

4) !pmd\_present() && !pmd\_trans\_huge()
  Neither PRESENT nor PROTNONE set
  =\> not present

I've checked all archs that implement pmd\_trans\_huge() (arm64, riscv,
powerpc, longarch, x86, mips, s390) and this logic roughly translates
(though devmap treatment is unique to x86 and powerpc, and (3) doesn't
necessarily hold in general -- but that doesn't matter since
!pmd\_present() always takes failure path).

Also, add a comment above find\_pmd\_or\_thp\_or\_none()
---truncated---

## Affected and fixed versions

- Linux: \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< 96aaaf8666010a39430cecf8a65c7ce2908a030f; \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< edb5d0cf5525357652aff6eacd9850b8ced07143 (cvelist)
- Linux: 6.1 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-52934. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-52934.md
Affected: Linux >= 34488399fa08faaf664743fa54b271eb6f9e1321, < 96aaaf8666010a39430cecf8a65c7ce2908a030f; >= 34488399fa08faaf664743fa54b271eb6f9e1321, < edb5d0cf5525357652aff6eacd9850b8ced07143; Linux 6.1
Fixed in: Linux 96aaaf8666010a39430cecf8a65c7ce2908a030f

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-52934 being exploited?

There is no confirmed exploitation: CVE-2023-52934 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-52934?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2023-52934?

Linux \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< 96aaaf8666010a39430cecf8a65c7ce2908a030f; \>= 34488399fa08faaf664743fa54b271eb6f9e1321, \< edb5d0cf5525357652aff6eacd9850b8ced07143; Linux 6.1.

### Is there a fix for CVE-2023-52934?

Yes. Fixed in Linux 96aaaf8666010a39430cecf8a65c7ce2908a030f. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2023-52934?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/96aaaf8666010a39430cecf8a65c7ce2908a030f>
- patch: <https://git.kernel.org/stable/c/edb5d0cf5525357652aff6eacd9850b8ced07143>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-52934>

HTML: <https://flawdb.com/CVE-2023-52934> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-52934>
