# CVE-2023-53178: mm: fix zswap writeback race condition

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-09-15T14:04:23.768Z
- **Modified:** 2026-08-05T09:12:56.392Z

## Who should check

- Anyone running Linux \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 2cab13f500a6333bd2b853783ac76be9e4956f8a; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< ba700ea13bf0105a4773c654f7d3bef8adb64ab2; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 04fc7816089c5a32c29a04ec94b998e219dfb946
- Anyone running Linux 3.11

## Description

In the Linux kernel, the following vulnerability has been resolved:

mm: fix zswap writeback race condition

The zswap writeback mechanism can cause a race condition resulting in
memory corruption, where a swapped out page gets swapped in with data that
was written to a different page.

The race unfolds like this:
1. a page with data A and swap offset X is stored in zswap
2. page A is removed off the LRU by zpool driver for writeback in
   zswap-shrink work, data for A is mapped by zpool driver
3. user space program faults and invalidates page entry A, offset X is
   considered free
4. kswapd stores page B at offset X in zswap (zswap could also be
   full, if so, page B would then be IOed to X, then skip step 5.)
5. entry A is replaced by B in tree-\>rbroot, this doesn't affect the
   local reference held by zswap-shrink work
6. zswap-shrink work writes back A at X, and frees zswap entry A
7. swapin of slot X brings A in memory instead of B

The fix:
Once the swap page cache has been allocated (case ZSWAP\_SWAPCACHE\_NEW),
zswap-shrink work just checks that the local zswap\_entry reference is
still the same as the one in the tree.  If it's not the same it means that
it's either been invalidated or replaced, in both cases the writeback is
aborted because the local entry contains stale data.

Reproducer:
I originally found this by running \`stress\` overnight to validate my work
on the zswap writeback mechanism, it manifested after hours on my test
machine.  The key to make it happen is having zswap writebacks, so
whatever setup pumps /sys/kernel/debug/zswap/written\_back\_pages should do
the trick.

In order to reproduce this faster on a vm, I setup a system with ~100M of
available memory and a 500M swap file, then running \`stress --vm 1
--vm-bytes 300000000 --vm-stride 4000\` makes it happen in matter of tens
of minutes.  One can speed things up even more by swinging
/sys/module/zswap/parameters/max\_pool\_percent up and down between, say, 20
and 1; this makes it reproduce in tens of seconds.  It's crucial to set
\`--vm-stride\` to something other than 4096 otherwise \`stress\` won't
realize that memory has been corrupted because all pages would have the
same data.

## Affected and fixed versions

- Linux: \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 2cab13f500a6333bd2b853783ac76be9e4956f8a; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< ba700ea13bf0105a4773c654f7d3bef8adb64ab2; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 04fc7816089c5a32c29a04ec94b998e219dfb946 (cvelist)
- Linux: 3.11 (cvelist)

## Mitigation

- Upgrade Linux to 04fc7816089c5a32c29a04ec94b998e219dfb946 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-53178. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-53178.md
Affected: Linux >= 2b2811178e85553405b86e3fe78357b9b95889ce, < 2cab13f500a6333bd2b853783ac76be9e4956f8a; >= 2b2811178e85553405b86e3fe78357b9b95889ce, < ba700ea13bf0105a4773c654f7d3bef8adb64ab2; >= 2b2811178e85553405b86e3fe78357b9b95889ce, < 04fc7816089c5a32c29a04ec94b998e219dfb946; Linux 3.11
Fixed in: Linux 2cab13f500a6333bd2b853783ac76be9e4956f8a, Linux 04fc7816089c5a32c29a04ec94b998e219dfb946

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-53178 being exploited?

There is no confirmed exploitation: CVE-2023-53178 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-53178?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2023-53178?

Linux \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 2cab13f500a6333bd2b853783ac76be9e4956f8a; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< ba700ea13bf0105a4773c654f7d3bef8adb64ab2; \>= 2b2811178e85553405b86e3fe78357b9b95889ce, \< 04fc7816089c5a32c29a04ec94b998e219dfb946; Linux 3.11.

### Is there a fix for CVE-2023-53178?

Yes. Fixed in Linux 2cab13f500a6333bd2b853783ac76be9e4956f8a, Linux 04fc7816089c5a32c29a04ec94b998e219dfb946. Upgrade Linux to 04fc7816089c5a32c29a04ec94b998e219dfb946 or later.

### How do I check if I'm affected by CVE-2023-53178?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/2cab13f500a6333bd2b853783ac76be9e4956f8a>
- patch: <https://git.kernel.org/stable/c/ba700ea13bf0105a4773c654f7d3bef8adb64ab2>
- patch: <https://git.kernel.org/stable/c/04fc7816089c5a32c29a04ec94b998e219dfb946>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-53178>

HTML: <https://flawdb.com/CVE-2023-53178> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-53178>
