# CVE-2025-40272: mm/secretmem: fix use-after-free race in fault handler

> 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.23% (percentile 8, 2026-11-26)
- **Published:** 2025-12-06T21:50:54.629Z
- **Modified:** 2026-10-15T22:19:06.473Z

## Who should check

- Anyone running Linux \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< bb1c19636aedae39360e6fdbcaef4f2bcff25785; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 1e4643d6628edf9c0047b1f8f5bc574665025acb; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 42d486d35a4143cc37fc72ee66edc99d942dd367; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 4444767e625da46009fc94a453fd1967b80ba047; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 6f86d0534fddfbd08687fa0f01479d4226bc3c3d
- Anyone running Linux 5.14

## Description

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

mm/secretmem: fix use-after-free race in fault handler

When a page fault occurs in a secret memory file created with
\`memfd\_secret(2)\`, the kernel will allocate a new folio for it, mark the
underlying page as not-present in the direct map, and add it to the file
mapping.

If two tasks cause a fault in the same page concurrently, both could end
up allocating a folio and removing the page from the direct map, but only
one would succeed in adding the folio to the file mapping.  The task that
failed undoes the effects of its attempt by (a) freeing the folio again
and (b) putting the page back into the direct map.  However, by doing
these two operations in this order, the page becomes available to the
allocator again before it is placed back in the direct mapping.

If another task attempts to allocate the page between (a) and (b), and the
kernel tries to access it via the direct map, it would result in a
supervisor not-present page fault.

Fix the ordering to restore the direct map before the folio is freed.

## Affected and fixed versions

- Linux: \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< bb1c19636aedae39360e6fdbcaef4f2bcff25785; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 1e4643d6628edf9c0047b1f8f5bc574665025acb; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 42d486d35a4143cc37fc72ee66edc99d942dd367; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 4444767e625da46009fc94a453fd1967b80ba047; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 6f86d0534fddfbd08687fa0f01479d4226bc3c3d (cvelist)
- Linux: 5.14 (cvelist)

## Mitigation

- Upgrade Linux to 6f86d0534fddfbd08687fa0f01479d4226bc3c3d or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-40272.md
Affected: Linux >= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, < bb1c19636aedae39360e6fdbcaef4f2bcff25785; >= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, < 1e4643d6628edf9c0047b1f8f5bc574665025acb; >= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, < 42d486d35a4143cc37fc72ee66edc99d942dd367; >= 1507f51255c9ff07d75909a…
Fixed in: Linux 1e4643d6628edf9c0047b1f8f5bc574665025acb, Linux 42d486d35a4143cc37fc72ee66edc99d942dd367, Linux 52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649, Linux 4444767e625da46009fc94a453fd1967b80ba047, Linux 6f86d0534fddfbd08687fa0f01479d4226bc3c3d

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-2025-40272 being exploited?

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

### How serious is CVE-2025-40272?

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

### Which versions are affected by CVE-2025-40272?

Linux \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< bb1c19636aedae39360e6fdbcaef4f2bcff25785; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 1e4643d6628edf9c0047b1f8f5bc574665025acb; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 42d486d35a4143cc37fc72ee66edc99d942dd367; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 4444767e625da46009fc94a453fd1967b80ba047; \>= 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, \< 6f86d0534fddfbd08687fa0f01479d4226bc3c3d; Linux 5.14.

### Is there a fix for CVE-2025-40272?

Yes. Fixed in Linux 1e4643d6628edf9c0047b1f8f5bc574665025acb, Linux 42d486d35a4143cc37fc72ee66edc99d942dd367, Linux 52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649, Linux 4444767e625da46009fc94a453fd1967b80ba047, Linux 6f86d0534fddfbd08687fa0f01479d4226bc3c3d. Upgrade Linux to 6f86d0534fddfbd08687fa0f01479d4226bc3c3d or later.

### How do I check if I'm affected by CVE-2025-40272?

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

- other: <https://git.kernel.org/stable/c/bb1c19636aedae39360e6fdbcaef4f2bcff25785>
- other: <https://git.kernel.org/stable/c/1e4643d6628edf9c0047b1f8f5bc574665025acb>
- other: <https://git.kernel.org/stable/c/42d486d35a4143cc37fc72ee66edc99d942dd367>
- other: <https://git.kernel.org/stable/c/52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649>
- other: <https://git.kernel.org/stable/c/4444767e625da46009fc94a453fd1967b80ba047>
- other: <https://git.kernel.org/stable/c/6f86d0534fddfbd08687fa0f01479d4226bc3c3d>

## 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-2025-40272>

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