{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139799","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2026-11-30T13:22:15.953Z","datePublished":"2026-11-30T13:38:06.394Z","dateUpdated":"2026-12-01T05:43:29.150Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-12-01T05:43:29.150Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/shmem: hold off eviction in shmem_writeout()\n\nOnce shmem_writeout() has moved the folio from the page cache to the\nswap cache, the folio lock no longer keeps the inode alive: truncation\nand eviction find a swap entry, free it and do not wait for anybody.\nThat did not matter as long as swap_writeout() was the last thing the\nfunction did.  But since it puts the folio back when swap_writeout()\nreturns AOP_WRITEPAGE_ACTIVATE, it uses the mapping and the inode\nafterwards:\n\n  reclaim                               last close of an unlinked file\n  shmem_writeout()\n    shmem_delete_from_page_cache()\n    swap_writeout()\n      zswap_store() fails               shmem_evict_inode()\n      writeback is disabled               shmem_truncate_range()\n      return AOP_WRITEPAGE_ACTIVATE         shmem_free_swap()\n                                        destroy_inode()\n                                        ... RCU grace period, freed\n    shmem_add_to_page_cache(mapping)\n      xas_lock_irq()            <- use after free\n\nswap_writeout() behaves that way if zswap is enabled, cannot take the\nfolio and the memcg or one of its ancestors has memory.zswap.writeback\nset to 0.\n\nshmem_unuse() already added infrastructure to deal with that.\nReuse info->stop_eviction to protect the inode during writeout. Increment\nit before removing the folio from the page cache, and decrement it after\nswap_writeout() and any attempted reinsertion and inode accounting.\nIn shmem_evict_inode(), wait for the counter to reach zero even if\nswapoff has already removed the inode from the swap list. Add some helpers\nto make the code easier to digest.\n\nThere is a known remaining issue with two swapoffs racing, and the empty\nlist check not being able to detect that race. That will be addressed\nseparately later.\n\nFix generated by an LLM and sent by Josef Bacik in private.\n\n[ david: code cleanups; improve description ]"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - A local user creates the inode with memfd_create() (shmem file, clear_nlink) and writes data. They force reclaim via memory.reclaim, which reaches pageout()->shmem_writeout(), and close the last fd to run shmem_evict_inode(). No remote peer supplies any data.\nAC:H - swap_writeout() returns AOP_WRITEPAGE_ACTIVATE only if zswap is globally enabled (CONFIG_ZSWAP_DEFAULT_ON is off by default, root-only module param) and a swap device is active. The eviction must also land after folio_free_swap() and finish its RCU grace period before shmem_add_to_page_cache() runs.\nPR:L - memory.zswap.writeback is created owned by the mkdir caller (current_fsuid), and systemd's user@.service has Delegate=pids memory cpu. An unprivileged user can therefore set writeback=0 in their own child memcg, fill a memfd with incompressible data, and trigger the race.\nUI:N - The attacker performs every step themselves: memfd write, cgroup writeback=0, memory.reclaim to drive shmem_writeout(), and close() to drive shmem_evict_inode(). No other user has to act.\nS:U - The use-after-free corrupts kernel memory in the same kernel security authority that the local attacker targets. No guest/host, IOMMU or other boundary is crossed.\nC:H - After the RCU free of the shmem_inode_info, shmem_add_to_page_cache() walks the freed inode's i_pages xarray from reclaimable slab memory. If that memory is reclaimed cross-cache and refilled by the attacker, the walk follows attacker-controlled pointers, which can be leveraged for kernel memory disclosure.\nI:H - shmem_add_to_page_cache() takes and releases xas_lock_irq on freed memory and can xas_store() the folio pointer and bump mapping->nrpages in the freed inode. These are writes into reused memory that are exploitable for kernel memory corruption.\nA:H - Locking a spinlock inside a freed and reused shmem_inode_info with IRQs disabled can hard-lock the CPU, and walking a corrupted xarray oopses. Either way the kernel crashes, and KASAN flags the access as a use-after-free."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/shmem.c"],"versions":[{"version":"6344a6d9ce13ae29e3ddf280fd8a1109a77b9996","lessThan":"d64fd1229fb1437d7c62c49eba82691bfd65d541","status":"affected","versionType":"git"},{"version":"6344a6d9ce13ae29e3ddf280fd8a1109a77b9996","lessThan":"f53ee5a65460010cabd75895d83258d90923ca7a","status":"affected","versionType":"git"},{"version":"6344a6d9ce13ae29e3ddf280fd8a1109a77b9996","lessThan":"8f59173b5ca358bf4d1017b44da3cbe6faa80daf","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/shmem.c"],"versions":[{"version":"6.17","status":"affected"},{"version":"0","lessThan":"6.17","status":"unaffected","versionType":"semver"},{"version":"6.18.65","lessThanOrEqual":"6.18.*","status":"unaffected","versionType":"semver"},{"version":"7.3.6","lessThanOrEqual":"7.3.*","status":"unaffected","versionType":"semver"},{"version":"7.4-rc2","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.17","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.17","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.17","versionEndExcluding":"7.4-rc2"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/d64fd1229fb1437d7c62c49eba82691bfd65d541"},{"url":"https://git.kernel.org/stable/c/f53ee5a65460010cabd75895d83258d90923ca7a"},{"url":"https://git.kernel.org/stable/c/8f59173b5ca358bf4d1017b44da3cbe6faa80daf"}],"title":"mm/shmem: hold off eviction in shmem_writeout()","x_generator":{"engine":"bippy-1.2.0"}}}}