CVE-2022-49700·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: mm/slub: add missing TID updates on slab deactivation The fastpath in slab_alloc_node() assumes that c->slab is stable as long as the TID stays the same. However, two places in __slab_alloc() currently don't update the TID when deactivating the CPU slab. If multiple operations race the right way, this could lead to an object getting lost; or, in an even more unlikely situation, it could even lead to an object being freed onto the wrong slab's freelist, messing up the `inuse` counter and eventually causing a page to be freed to the page allocator while it still contains slab objects. (I haven't actually tested these cases though, this is just based on looking at the code. Writing testcases for this stuff seems like it'd be a pain...) The race leading to state inconsistency is (all operations on the same CPU and kmem_cache): - task A: begin do_slab_free(): - read TID - read pcpu freelist (==NULL) - check `slab == c->slab` (true) - [PREEMPT A->B] - task B: begin slab_alloc_node(): - fastpath fails (`c->freelist` is NULL) - enter __slab_alloc() - slub_get_cpu_ptr() (disables preemption) - enter ___slab_alloc() - take local_lock_irqsave() - read c->freelist as NULL - get_freelist() returns NULL - write `c->slab = NULL` - drop local_unlock_irqrestore() - goto new_slab - slub_percpu_partial() is NULL - get_partial() returns NULL - slub_put_cpu_ptr() (enables preemption) - [PREEMPT B->A] - task A: finish do_slab_free(): - this_cpu_cmpxchg_double() succeeds() - [CORRUPT STATE: c->slab==NULL, c->freelist!=NULL] From there, the object on c->freelist will get lost if task B is allowed to continue from here: It will proceed to the retry_load_slab label, set c->slab, then jump to load_freelist, which clobbers c->freelist. But if we instead continue as follows, we get worse corruption: - task A: run __slab_free() on object from other struct slab: - CPU_PARTIAL_FREE case (slab was on no list, is now on pcpu partial) - task A: run slab_alloc_node() with NUMA node constraint: - fastpath fails (c->slab is NULL) - call __slab_alloc() - slub_get_cpu_ptr() (disables preemption) - enter ___slab_alloc() - c->slab is NULL: goto new_slab - slub_percpu_partial() is non-NULL - set c->slab to slub_percpu_partial(c) - [CORRUPT STATE: c->slab points to slab-1, c->freelist has objects from slab-2] - goto redo - node_match() fails - goto deactivate_slab - existing c->freelist is passed into deactivate_slab() - inuse count of slab-1 is decremented to account for object from slab-2 At this point, the inuse count of slab-1 is 1 lower than it should be. This means that if we free all allocated objects in slab-1 except for one, SLUB will think that slab-1 is completely unused, and may free its page, leading to use-after-free.
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.18.8
- Published
- 2025-02-26
Affected versions
From: 5.16
Until: 5.18.8
Fixed in: 5.18.8
How to fix this CVE
Update your Linux kernel to version 5.18.8 or later to resolve a critical race condition in the SLUB memory allocator that can cause object corruption and use-after-free vulnerabilities. Systems running kernels 5.16 through 5.18.7 are vulnerable to state inconsistencies when multiple preemption events coincide with slab deactivation operations. Apply this update immediately to prevent potential privilege escalation or system instability.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Check installed kernel version: uname -r — verify the version is 5.18.8 or later
- Confirm kernel build date matches or exceeds the patch release: uname -v — look for build timestamp after the CVE-2022-49700 fix date (September 2022)
- Monitor kernel logs for memory corruption indicators: sudo dmesg | grep -i 'slub\|slab.*error\|page.*corruption' — watch for SLUB allocator warnings or page freelist anomalies
- Verify patch application by checking kernel config: grep CONFIG_SLUB /boot/config-$(uname -r) — confirm SLUB is enabled, then cross-reference kernel git commit hashes against patch references
FAQ
What is CVE-2022-49700?
CVE-2022-49700 is a race condition in the Linux SLUB memory allocator where missing TID (transaction ID) updates during slab deactivation can allow concurrent operations to corrupt memory state, potentially freeing objects to the wrong freelist or creating use-after-free conditions.
Is CVE-2022-49700 being actively exploited?
No, CVE-2022-49700 is not documented as being actively exploited in the wild and does not appear on the CISA Known Exploited Vulnerabilities (KEV) catalog. However, the vulnerability requires precise race timing and may be difficult to trigger reliably.
What versions of Kernel are affected by CVE-2022-49700?
Linux kernel versions 5.16 through 5.18.7 are vulnerable. The fix was included in kernel 5.18.8 and later stable releases.
How do I check if my server is vulnerable to CVE-2022-49700?
Run 'uname -r' and compare the version against 5.18.8. If your kernel version is 5.16.x through 5.18.7, your system is vulnerable. You can also check 'cat /boot/config-$(uname -r) | grep CONFIG_SLUB' to confirm SLUB allocator is enabled.
Does Defensia detect CVE-2022-49700?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the Linux kernel is installed on a monitored server, CVE-2022-49700 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/0515cc9b6b24877f59b222ade704bfaa42caa2a6
- https://git.kernel.org/stable/c/197e257da473c725dfe47759c3ee02f2398d8ea5
- https://git.kernel.org/stable/c/308c6d0e1f200fd26c71270c6e6bfcf0fc6ff082
- https://git.kernel.org/stable/c/6c32496964da0dc230cea763a0e934b2e02dabd5
- https://git.kernel.org/stable/c/d6a597450e686d4c6388bd3cdcb17224b4dae7f0
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2022-49700. Free for 1 server.
Get started free