CVE-2024-35797: mm: cachestat: fix two shmem bugs

Published May 17, 2024
·
Updated

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

mm: cachestat: fix two shmem bugs

The Linux kernel CVE team has assigned CVE-2024-35797 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024051737-CVE-2024-35797-06f6@gregkh/T

Other sources

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

mm: cachestat: fix two shmem bugs

When cachestat on shmem races with swapping and invalidation, there are two possible bugs:

1) A swapin error can have resulted in a poisoned swap entry in the shmem inode's xarray. Calling getshadowfromswapcache() on it will result in an out-of-bounds access to swapperspaces[].

Validate the entry with nonswapentry() before going further.

2) When we find a valid swap entry in the shmem's inode, the shadow entry in the swapcache might not exist yet: swap IO is still in progress and we're before removemapping; swapin, invalidation, or swapoff have removed the shadow from swapcache after we saw the shmem swap entry.

This will send a NULL to workingsettestrecent(). The latter purely operates on pointer bits, so it won't crash - node 0, memcg ID 0, eviction timestamp 0, etc. are all valid inputs - but it's a bogus test. In theory that could result in a false "recently evicted" count.

Such a false positive wouldn't be the end of the world. But for code clarity and (future) robustness, be explicit about this case.

Bail on getshadowfromswapcache() returning NULL.

NVD

Affected Software

9 affected componentsFixes available
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.22-16.12.25-1
redhat/kernel<6.6.24
6.6.24
redhat/kernel<6.7.12
6.7.12
redhat/kernel<6.8.3
6.8.3
redhat/kernel<6.9
6.9
Linux Linux kernel>=6.5<6.6.24
Linux Linux kernel>=6.7<6.7.12
Linux Linux kernel>=6.8<6.8.3
Linux Linux kernel=6.9-rc1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.22-1Fixed in 6.12.25-1
  2. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.6.24
  3. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.7.12
  4. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.8.3
  5. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.9

Event History

May 17, 2024
CVE Published
via MITRE·01:23 PM
Data Sourced
via MITRE·01:23 PM
DescriptionSeverity
Data Sourced
via NVD·02:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:15 PM
RemedyAffected Software
Data Sourced
via Red Hat·10:44 PM
DescriptionSeverityAffected Software
Jun 8, 2024
Data Sourced
via Launchpad·01:15 AM
Description
Dec 1, 2024
Data Sourced
via Ubuntu·05:30 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35797?

CVE-2024-35797 has been classified as a moderate severity vulnerability in the Linux kernel.

2

How do I fix CVE-2024-35797?

To fix CVE-2024-35797, update the Linux kernel to version 6.6.24, 6.7.12, 6.8.3, 6.9, or specific versions provided by Debian such as 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.119-1, 6.12.11-1, or 6.12.12-1.

3

What systems are affected by CVE-2024-35797?

CVE-2024-35797 affects multiple versions of the Linux kernel, specifically from various Red Hat and Debian releases.

4

Can CVE-2024-35797 be exploited remotely?

CVE-2024-35797 requires local access to the system, thus it is not classified as a remote exploit vulnerability.

5

Is there a patch available for CVE-2024-35797?

Yes, patches for CVE-2024-35797 are included in the respective updates for the affected Linux kernel versions.

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