CVE-2024-35846 mm: zswap: fix shrinker NULL crash with cgroup_disable=memory
A NULL pointer dereference in the Linux kernel zswap shrinker causes a system crash when memory cgroups are disabled via boot parameters.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-35846?
CVE-2024-35846 is a medium-severity vulnerability in Linux kernel, published on 17 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
mm: zswap: fix shrinker NULL crash with cgroup_disable=memory
Christian reports a NULL deref in zswap that he bisected down to the zswap shrinker. The issue also cropped up in the bug trackers of libguestfs [1] and the Red Hat bugzilla [2].
The problem is that when memcg is disabled with the boot time flag, the zswap shrinker might get called with sc->memcg == NULL. This is okay in many places, like the lruvec operations. But it crashes in memcg_page_state() - which is only used due to the non-node accounting of cgroup's the zswap memory to begin with.
Nhat spotted that the memcg can be NULL in the memcg-disabled case, and I was then able to reproduce the crash locally as well.
[1] https://github.com/libguestfs/libguestfs/issues/139 [2] https://bugzilla.redhat.com/show_bug.cgi?id=2275252
Weakness: CWE-476
Which versions are affected by CVE-2024-35846?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2024-35846?
Apply the vendor's patch.
Is CVE-2024-35846 being exploited?
There is no known exploitation of CVE-2024-35846 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as BELL-CVE-2024-35846, DEBIAN-CVE-2024-35846, GHSA-657p-cp5v-hvxv, UBUNTU-CVE-2024-35846.