# CVE-2026-99739: mm/shmem: fix truncate hang in large swap entry

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.18% (percentile 8, 2026-12-01)
- **Published:** 2026-11-20T05:51:11.996Z
- **Modified:** 2026-11-20T06:18:11.590Z

## Who should check

- Anyone running Linux \>= a99f9a4669a04662c8f9efe0e62cafc598153139, \< 9fbca74e8efbb8fed180639af349449f04a2a3c3; \>= b23bee8cdb7aabce5701a7f57414db5a354ae8ed, \< 577374a2171cdb68e492725feb564364f93161b6; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< ef6daf302dc569a67fe50968f9b6085f111b8560; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< fa213b08f37f9dff78ce240a87579dc264fc7a5d; \>= 6.12.69, \< 6.12.118; \>= 6.18.9, \< 6.18.64
- Anyone running Linux 6.19

## Description

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

mm/shmem: fix truncate hang in large swap entry

Truncating a tmpfs file or memfd to a page-aligned size inside a large
swap entry can loop indefinitely in shmem\_undo\_range(). The task holds
the inode lock and cannot be killed.

A large swap entry represents a whole swapped-out folio. For example,
truncate a file whose pages 0-7 share one swap entry to four pages:

    \[ 0  1  2  3 \| 4  5  6  7 \]
         keep    \|   discard
                 ^
            new EOF, start = 4

i\_size has already been updated when boundary handling asks
shmem\_get\_partial\_folio() for page 4. Since it is swapped out, the helper
calls shmem\_get\_folio() with SGP\_READ. That rejects page 4 with -EINVAL
because its starting offset equals i\_size. Nothing is read back.

The final scan cannot free the entry without losing pages 0-3. It skips
it, restarts from start = 4, and finds it again indefinitely. An unaligned
truncate avoids this particular failure because the requested page starts
below i\_size. Folios already in the page-cache cannot trigger it as the
direct lookup will return them beyond EOF.

Fix it by letting shmem\_get\_partial\_folio() call shmem\_swapin\_folio()
directly for swap entries. This bypasses the read path's i\_size check,
allowing the existing boundary handling to zero and split the folio. If
swap-in returns a smaller folio, it also splits the swap entry so the
final scan can free the entries beyond EOF. Retry the lookup if the entry
changes during swap-in.

Handling swap-in allocation failures remains broken and is unchanged by
this commit. Even when shmem\_swapin\_folio() correctly returns -ENOMEM
instead of -EEXIST, shmem\_get\_partial\_folio() returns NULL and
shmem\_undo\_range() skips boundary handling. If the large swap entry
remains intact, truncation can still loop in the final scan, while hole
punching can return without zeroing the boundary.

This may read an entire large folio back from swap while holding
i\_rwsem, only to discard part of it. Avoiding that I/O would require
splitting both the swap entry and any large folio still in the swap
cache. That, however, is much bigger work.

## Affected and fixed versions

- Linux: \>= a99f9a4669a04662c8f9efe0e62cafc598153139, \< 9fbca74e8efbb8fed180639af349449f04a2a3c3; \>= b23bee8cdb7aabce5701a7f57414db5a354ae8ed, \< 577374a2171cdb68e492725feb564364f93161b6; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< ef6daf302dc569a67fe50968f9b6085f111b8560; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< fa213b08f37f9dff78ce240a87579dc264fc7a5d; \>= 6.12.69, \< 6.12.118; \>= 6.18.9, \< 6.18.64 (cvelist)
- Linux: 6.19 (cvelist)

## Technologies

Linux kernel

## Mitigation

- Upgrade Linux to 6.18.64 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2026-99739.md
Affected: Linux >= a99f9a4669a04662c8f9efe0e62cafc598153139, < 9fbca74e8efbb8fed180639af349449f04a2a3c3; >= b23bee8cdb7aabce5701a7f57414db5a354ae8ed, < 577374a2171cdb68e492725feb564364f93161b6; >= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, < ef6daf302dc569a67fe50968f9b6085f111b8560; >= 8a1968bd997f45a9b11aefe…
Fixed in: Linux 9fbca74e8efbb8fed180639af349449f04a2a3c3, Linux 577374a2171cdb68e492725feb564364f93161b6, Linux 6.12.118, Linux 6.18.64

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-2026-99739 being exploited?

There is no confirmed exploitation: CVE-2026-99739 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-12-01).

### How serious is CVE-2026-99739?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2026-99739?

Linux \>= a99f9a4669a04662c8f9efe0e62cafc598153139, \< 9fbca74e8efbb8fed180639af349449f04a2a3c3; \>= b23bee8cdb7aabce5701a7f57414db5a354ae8ed, \< 577374a2171cdb68e492725feb564364f93161b6; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< ef6daf302dc569a67fe50968f9b6085f111b8560; \>= 8a1968bd997f45a9b11aefeabdd1232e1b6c7184, \< fa213b08f37f9dff78ce240a87579dc264fc7a5d; \>= 6.12.69, \< 6.12.118; \>= 6.18.9, \< 6.18.64; Linux 6.19.

### Is there a fix for CVE-2026-99739?

Yes. Fixed in Linux 9fbca74e8efbb8fed180639af349449f04a2a3c3, Linux 577374a2171cdb68e492725feb564364f93161b6, Linux 6.12.118, Linux 6.18.64. Upgrade Linux to 6.18.64 or later.

### How do I check if I'm affected by CVE-2026-99739?

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/9fbca74e8efbb8fed180639af349449f04a2a3c3>
- other: <https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6>
- other: <https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560>
- other: <https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d>

## 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-2026-99739>
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

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