CVE-2025-21860: mm/zswap: fix inconsistency when zswap_store_page() fails

Published Mar 12, 2025
·
Updated

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

mm/zswap: fix inconsistency when zswapstorepage() fails

Commit b7c0ccdfbafd ("mm: zswap: support large folios in zswapstore()") skips charging any zswap entries when it failed to zswap the entire folio.

However, when some base pages are zswapped but it failed to zswap the entire folio, the zswap operation is rolled back. When freeing zswap entries for those pages, zswapentryfree() uncharges the zswap entries that were not previously charged, causing zswap charging to become inconsistent.

This inconsistency triggers two warnings with following steps: # On a machine with 64GiB of RAM and 36GiB of zswap $ stress-ng --bigheap 2 # wait until the OOM-killer kills stress-ng $ sudo reboot

The two warnings are: in mm/memcontrol.c:163, function objcgrouprelease(): WARNONONCE(nrbytes & (PAGESIZE - 1));

in mm/pagecounter.c:60, function pagecountercancel(): if (WARNONCE(new < 0, "pagecounter underflow: %ld nrpages=%lu\n", new, nrpages))

zswapstoredpages also becomes inconsistent in the same way.

As suggested by Kanchana, increment zswapstoredpages and charge zswap entries within zswapstorepage() when it succeeds. This way, zswapentryfree() will decrement the counter and uncharge the entries when it failed to zswap the entire folio.

While this could potentially be optimized by batching objcg charging and incrementing the counter, let's focus on fixing the bug this time and leave the optimization for later after some evaluation.

After resolving the inconsistency, the warnings disappear.

[42.hyeyoo@gmail.com: refactor zswapstorepage()]

Affected Software

5 affected components
Linux Linux kernel>=6.13<6.13.5
Linux Linux kernel=6.14-rc1
Linux Linux kernel=6.14-rc2
Linux Linux kernel=6.14-rc3
Linux Kernel

Event History

Mar 12, 2025
CVE Published
via MITRE·09:42 AM
Data Sourced
via MITRE·09:42 AM
Description
Data Sourced
via NVD·10:15 AM
Description
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-21860?

CVE-2025-21860 has a medium severity level due to its potential impact on system stability in the Linux kernel.

2

How do I fix CVE-2025-21860?

To fix CVE-2025-21860, update your Linux kernel to the latest version that includes the patch for the inconsistency in zswap_store_page().

3

Which systems are affected by CVE-2025-21860?

CVE-2025-21860 affects various versions of the Linux kernel that utilize the zswap feature.

4

What are the potential impacts of CVE-2025-21860?

The potential impacts of CVE-2025-21860 include instability and unexpected behavior when large folios are used with zswap.

5

What is the nature of the inconsistency in CVE-2025-21860?

The inconsistency in CVE-2025-21860 occurs when zswap_store_page() fails, leading to improper handling of zswap entries.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203