FKIE_CVE-2026-99739
Vulnerability from fkie_nvd - Published: 2026-11-20 06:18 - Updated: 2026-11-20 06:18
Severity
Summary
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.
References
Impacted products
| Vendor | Product | Version |
|---|
{
"affected": [
{
"affectedData": [
{
"defaultStatus": "unaffected",
"product": "Linux",
"programFiles": [
"mm/shmem.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"lessThan": "9fbca74e8efbb8fed180639af349449f04a2a3c3",
"status": "affected",
"version": "a99f9a4669a04662c8f9efe0e62cafc598153139",
"versionType": "git"
},
{
"lessThan": "577374a2171cdb68e492725feb564364f93161b6",
"status": "affected",
"version": "b23bee8cdb7aabce5701a7f57414db5a354ae8ed",
"versionType": "git"
},
{
"lessThan": "ef6daf302dc569a67fe50968f9b6085f111b8560",
"status": "affected",
"version": "8a1968bd997f45a9b11aefeabdd1232e1b6c7184",
"versionType": "git"
},
{
"lessThan": "fa213b08f37f9dff78ce240a87579dc264fc7a5d",
"status": "affected",
"version": "8a1968bd997f45a9b11aefeabdd1232e1b6c7184",
"versionType": "git"
},
{
"lessThan": "6.12.118",
"status": "affected",
"version": "6.12.69",
"versionType": "semver"
},
{
"lessThan": "6.18.64",
"status": "affected",
"version": "6.18.9",
"versionType": "semver"
}
]
},
{
"defaultStatus": "affected",
"product": "Linux",
"programFiles": [
"mm/shmem.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"status": "affected",
"version": "6.19"
},
{
"lessThan": "6.19",
"status": "unaffected",
"version": "0",
"versionType": "semver"
},
{
"lessThanOrEqual": "6.12.*",
"status": "unaffected",
"version": "6.12.118",
"versionType": "semver"
},
{
"lessThanOrEqual": "6.18.*",
"status": "unaffected",
"version": "6.18.64",
"versionType": "semver"
},
{
"lessThanOrEqual": "7.3.*",
"status": "unaffected",
"version": "7.3.5",
"versionType": "semver"
},
{
"lessThanOrEqual": "*",
"status": "unaffected",
"version": "7.4-rc2",
"versionType": "original_commit_for_fix"
}
]
}
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
}
],
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmm/shmem: fix truncate hang in large swap entry\n\nTruncating a tmpfs file or memfd to a page-aligned size inside a large\nswap entry can loop indefinitely in shmem_undo_range(). The task holds\nthe inode lock and cannot be killed.\n\nA large swap entry represents a whole swapped-out folio. For example,\ntruncate a file whose pages 0-7 share one swap entry to four pages:\n\n [ 0 1 2 3 | 4 5 6 7 ]\n keep | discard\n ^\n new EOF, start = 4\n\ni_size has already been updated when boundary handling asks\nshmem_get_partial_folio() for page 4. Since it is swapped out, the helper\ncalls shmem_get_folio() with SGP_READ. That rejects page 4 with -EINVAL\nbecause its starting offset equals i_size. Nothing is read back.\n\nThe final scan cannot free the entry without losing pages 0-3. It skips\nit, restarts from start = 4, and finds it again indefinitely. An unaligned\ntruncate avoids this particular failure because the requested page starts\nbelow i_size. Folios already in the page-cache cannot trigger it as the\ndirect lookup will return them beyond EOF.\n\nFix it by letting shmem_get_partial_folio() call shmem_swapin_folio()\ndirectly for swap entries. This bypasses the read path\u0027s i_size check,\nallowing the existing boundary handling to zero and split the folio. If\nswap-in returns a smaller folio, it also splits the swap entry so the\nfinal scan can free the entries beyond EOF. Retry the lookup if the entry\nchanges during swap-in.\n\nHandling swap-in allocation failures remains broken and is unchanged by\nthis commit. Even when shmem_swapin_folio() correctly returns -ENOMEM\ninstead of -EEXIST, shmem_get_partial_folio() returns NULL and\nshmem_undo_range() skips boundary handling. If the large swap entry\nremains intact, truncation can still loop in the final scan, while hole\npunching can return without zeroing the boundary.\n\nThis may read an entire large folio back from swap while holding\ni_rwsem, only to discard part of it. Avoiding that I/O would require\nsplitting both the swap entry and any large folio still in the swap\ncache. That, however, is much bigger work."
}
],
"id": "CVE-2026-99739",
"lastModified": "2026-11-20T06:18:11.590",
"metrics": {},
"published": "2026-11-20T06:18:11.590",
"references": [
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"url": "https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6"
},
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"url": "https://git.kernel.org/stable/c/9fbca74e8efbb8fed180639af349449f04a2a3c3"
},
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"url": "https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560"
},
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"url": "https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d"
}
],
"sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"vulnStatus": "Received"
}
Loading…
Loading…
Experimental. This forecast is provided for visualization only and may change without notice. Do not use it for operational decisions.
Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
Loading…
The MITRE ATT&CK techniques below are AI-generated suggestions, inferred from the description of the
vulnerability by the CIRCL/vulnerability-attack-technique-classification-roberta-base
model, served locally by ML-Gateway.
They have not been verified by an analyst and are provided for guidance only.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Loading…
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.
Loading…