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
A Linux memory-management race can corrupt data beyond a shared-memory truncation boundary and trigger kernel panics or swapoff hangs. Successful abuse requires local, low-privileged access according to the supplied CVSS vector. Systems using shared memory with swap, particularly ZSWAP workloads, warrant prompt review because integrity and availability impacts are high.
Executive priority
Treat as a high-priority Linux patching item for multi-user, container-hosting, or shared-workload systems using swap. Internet exposure alone does not establish reachability because the stated attack vector is local. Accelerate remediation where a kernel failure or unintended data modification would disrupt critical services.
Technical view
The shmem swap-freeing helper reads an XArray entry’s order without lock protection before conditionally erasing it. Concurrent splitting or replacement can make that order stale or unexpectedly large, allowing truncation beyond the intended boundary. The fix performs order retrieval and value validation inside the same critical section and skips entries crossing the end boundary.
Likely exposure
The bundle identifies Linux 6.12, 6.12.69, 6.18.9, and 6.19 as affected, plus an ambiguous “0” entry. Exposure is most relevant where untrusted local users or workloads can exercise shmem and swap activity. Distribution-specific package ranges and backport status are not provided.
Exploitation context
The supplied CVSS is 7.3 with local, low-privileged access required and no user interaction. The researcher observed random swapoff hangs and kernel panics during ZSWAP and shmem stress testing. The bundle does not identify KEV listing, active exploitation, or a public exploit.
Researcher notes
The affected-version data is incomplete and internally unusual: it includes “0” and repeated commit identifiers marked unaffected. Do not derive precise fixed-version boundaries from it. The referenced stable commits are the strongest supplied remediation anchors. The observed failures demonstrate reliability impact under stress, but do not establish malicious exploitation.
Mitigation direction
Apply a vendor kernel update containing the applicable referenced stable fix.
Check distribution advisories for package-specific affected and fixed versions.
Prioritize systems combining shared-memory workloads, swap, ZSWAP, and access by untrusted local users.
If no update is available, obtain mitigation guidance from the kernel or distribution vendor.
Validation and detection
Inventory running kernel versions and compare them with vendor advisories and the supplied affected versions.
Confirm installed kernel changelogs include the applicable referenced stable commit or an equivalent backport.
Review kernel logs for unexplained panics and operational records for swapoff hangs.
Regression-test shmem, swap, and ZSWAP workloads after updating.
Reboot into the corrected kernel and verify that it is running.
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.