{"api_version":"1","generated_at":"2026-11-20T07:30:05+00:00","cve":"CVE-2026-99739","urls":{"html":"https://cve.report/CVE-2026-99739","api":"https://cve.report/api/cve/CVE-2026-99739.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-99739","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-99739"},"summary":{"title":"mm/shmem: fix truncate hang in large swap entry","description":"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's 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.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-20 06:18:11","updated_at":"2026-11-20 06:18:11"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/9fbca74e8efbb8fed180639af349449f04a2a3c3","name":"https://git.kernel.org/stable/c/9fbca74e8efbb8fed180639af349449f04a2a3c3","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560","name":"https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d","name":"https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6","name":"https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-99739","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99739","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected a99f9a4669a04662c8f9efe0e62cafc598153139 9fbca74e8efbb8fed180639af349449f04a2a3c3 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b23bee8cdb7aabce5701a7f57414db5a354ae8ed 577374a2171cdb68e492725feb564364f93161b6 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 8a1968bd997f45a9b11aefeabdd1232e1b6c7184 ef6daf302dc569a67fe50968f9b6085f111b8560 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 8a1968bd997f45a9b11aefeabdd1232e1b6c7184 fa213b08f37f9dff78ce240a87579dc264fc7a5d git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.12.69 6.12.118 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.18.9 6.18.64 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.19","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.19 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.118 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.64 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.5 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc2 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"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"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.118","versionStartIncluding":"6.12.69","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.64","versionStartIncluding":"6.18.9","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.5","versionStartIncluding":"6.19","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc2","versionStartIncluding":"6.19","vulnerable":true}],"negate":false,"operator":"OR"}]}],"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's 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."}],"providerMetadata":{"dateUpdated":"2026-11-20T05:51:11.996Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/9fbca74e8efbb8fed180639af349449f04a2a3c3"},{"url":"https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6"},{"url":"https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560"},{"url":"https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d"}],"title":"mm/shmem: fix truncate hang in large swap entry","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-99739","datePublished":"2026-11-20T05:51:11.996Z","dateReserved":"2026-09-25T10:25:14.431Z","dateUpdated":"2026-11-20T05:51:11.996Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-20 06:18:11","lastModifiedDate":"2026-11-20 06:18:11","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"99739","Ordinal":"1","Title":"mm/shmem: fix truncate hang in large swap entry","CVE":"CVE-2026-99739","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"99739","Ordinal":"1","NoteData":"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's 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.","Type":"Description","Title":"mm/shmem: fix truncate hang in large swap entry"}]}}}