CVE-2026-23161: mm/shmem, swap: fix race of truncate and swap entry split
In the Linux kernel, the following vulnerability has been resolved:
mm/shmem, swap: fix race of truncate and swap entry split
The helper for shmem swap freeing is not handling the order of swap
entries correctly. It uses xa_cmpxchg_irq to erase the swap entry, but it
gets the entry order before that using xa_get_order without lock
protection, and it may get an outdated order value if the entry is split
or changed in other ways after the xa_get_order and before the
xa_cmpxchg_irq.
And besides, the order could grow and be larger than expected, and cause
truncation to erase data beyond the end border. For example, if the
target entry and following entries are swapped in or freed, then a large
folio was added in place and swapped out, using the same entry, the
xa_cmpxchg_irq will still succeed, it's very unlikely to happen though.
To fix that, open code the Xarray cmpxchg and put the order retrieval and
value checking in the same critical section. Also, ensure the order won't
exceed the end border, skip it if the entry goes across the border.
Skipping large swap entries crosses the end border is safe here. Shmem
truncate iterates the range twice, in the first iteration,
find_lock_entries already filtered such entries, and shmem will swapin the
entries that cross the end border and partially truncate the folio (split
the folio or at least zero part of it). So in the second loop here, if we
see a swap entry that crosses the end order, it must at least have its
content erased already.
I observed random swapoff hangs and kernel panics when stress testing
ZSWAP with shmem. After applying this patch, all problems are gone.
Security readout for executives and security teams
Plain-English summary
CVE-2026-23161 is a Linux kernel race condition in shmem and swap handling. Under specific memory-management timing, the kernel can erase data beyond an intended truncation boundary, causing data corruption, hangs, or panics. It matters most on Linux systems where local users can run workloads that exercise shared memory and swap.
Executive priority
Treat as high priority for Linux fleets with local users, shared compute, or workload isolation requirements. It is not documented as remotely exploitable, but kernel panics and potential data integrity impact justify timely patch planning and focused validation.
Technical view
The bug is in shmem swap freeing. The kernel reads Xarray swap-entry order outside the needed critical section, then later erases with compare-exchange. If the entry changes or is split meanwhile, an outdated order can cause incorrect truncation. The fix moves order retrieval and checks into the same critical section and skips entries crossing the end boundary.
Likely exposure
Exposure is limited to Linux systems running affected kernel builds listed in the CVE source bundle. The CVSS vector is local and requires low privileges, so remote unauthenticated exposure is not supported by the sources. Systems using shmem/tmpfs with swap or ZSWAP activity deserve closer review.
Exploitation context
The source bundle does not show public exploitation, KEV listing, or exploit tooling. The kernel commit notes random swapoff hangs and kernel panics observed during ZSWAP shmem stress testing. Treat this as a local reliability and integrity risk until vendor-specific advisories clarify real-world exploitability.
Researcher notes
Evidence is strongest for a kernel race in shmem swap truncation, fixed by synchronizing Xarray order retrieval with value checks. The source bundle does not provide a CWE, proof of exploitation, or distro-level package mappings. Confirm exact affected ranges through downstream vendor advisories.
Mitigation direction
Check vendor kernel advisories for fixed builds or backports.
Upgrade affected Linux kernels to a version containing the referenced stable fixes.
Prioritize shared or multi-user Linux hosts first.
Reduce exposure of untrusted local workloads where urgent patching is delayed.
Monitor for swapoff hangs, kernel panics, or unexplained shmem-related instability.
Validation and detection
Inventory running kernel versions across Linux systems.
Compare kernels against the CVE affected version data.
Verify whether referenced stable commits are present or backported.
Review distro changelogs for CVE-2026-23161 fixes.
Check operational logs for swapoff hangs or kernel panics.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2026-23161 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
0ADP providers
4Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.