CVE-2026-99739

Source
https://cve.org/CVERecord?id=CVE-2026-99739
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99739.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2026-99739
Published
2026-11-20T05:51:11Z
Modified
2026-11-20T07:00:16Z
Summary
mm/shmem: fix truncate hang in large swap entry
Details

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.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99739.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a99f9a4669a04662c8f9efe0e62cafc598153139
Fixed
9fbca74e8efbb8fed180639af349449f04a2a3c3
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
b23bee8cdb7aabce5701a7f57414db5a354ae8ed
Fixed
577374a2171cdb68e492725feb564364f93161b6
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
8a1968bd997f45a9b11aefeabdd1232e1b6c7184
Fixed
ef6daf302dc569a67fe50968f9b6085f111b8560
Fixed
fa213b08f37f9dff78ce240a87579dc264fc7a5d

Affected versions

v6.*
v6.12.100
v6.12.101
v6.12.102
v6.12.103
v6.12.104
v6.12.105
v6.12.106
v6.12.107
v6.12.108
v6.12.109
v6.12.110
v6.12.111
v6.12.112
v6.12.113
v6.12.114
v6.12.115
v6.12.116
v6.12.117
v6.12.69
v6.12.70
v6.12.71
v6.12.72
v6.12.73
v6.12.74
v6.12.75
v6.12.76
v6.12.77
v6.12.78
v6.12.79
v6.12.80
v6.12.81
v6.12.82
v6.12.83
v6.12.84
v6.12.85
v6.12.86
v6.12.87
v6.12.88
v6.12.89
v6.12.90
v6.12.91
v6.12.92
v6.12.93
v6.12.94
v6.12.95
v6.12.96
v6.12.97
v6.12.98
v6.12.99
v6.18.10
v6.18.11
v6.18.12
v6.18.13
v6.18.14
v6.18.15
v6.18.16
v6.18.17
v6.18.18
v6.18.19
v6.18.20
v6.18.21
v6.18.22
v6.18.23
v6.18.24
v6.18.25
v6.18.26
v6.18.27
v6.18.28
v6.18.29
v6.18.30
v6.18.31
v6.18.32
v6.18.33
v6.18.34
v6.18.35
v6.18.36
v6.18.37
v6.18.38
v6.18.39
v6.18.40
v6.18.41
v6.18.42
v6.18.43
v6.18.44
v6.18.45
v6.18.46
v6.18.47
v6.18.48
v6.18.49
v6.18.50
v6.18.51
v6.18.52
v6.18.53
v6.18.54
v6.18.55
v6.18.56
v6.18.57
v6.18.58
v6.18.59
v6.18.60
v6.18.61
v6.18.62
v6.18.63
v6.18.9

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99739.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.12.69
Fixed
6.12.118
Type
ECOSYSTEM
Events
Introduced
6.18.9
Fixed
6.18.64
Type
ECOSYSTEM
Events
Introduced
6.19.0
Fixed
7.3.5

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99739.json"