CVE-2022-49700

mm/slub: add missing TID updates on slab deactivation

HIGH
7.8
CVSS Score
Published: February 26, 2025 at 02:24 AM UTC
Updated: August 5, 2026 at 09:24 AM UTC
1 product affected across 1 vendorLinux Kernel

Using Linux by Linux?

Get instant alerts when new vulnerabilities affect Linux - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.8
Exploit prediction
EPSS 0.3%
SSVC
No known exploit

Description

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

3.1 ≤ v < 4.14.2883.1 ≤ v < 4.19.2523.1 ≤ v < 4.9.3233.1 ≤ v < 5.10.1303.1 ≤ v < 5.15.543.1 ≤ v < 5.18.83.1 ≤ v < 5.193.1 ≤ v < 5.4.2054.10 ≤ v < 4.14.2884.15 ≤ v < 4.19.2524.20 ≤ v < 5.4.2055.11 ≤ v < 5.15.545.16 ≤ v < 5.18.85.5 ≤ v < 5.10.1303e404af26dc2ea0d278d7a342de0aab394793ce5.19 rc15.19 rc25.19 rc3
Vendor states this is fixed in 0515cc9b6b24877f59b222ade704bfaa42caa2a6 (fixed)
Vendor states this is fixed in 197e257da473c725dfe47759c3ee02f2398d8ea5 (fixed)
Vendor states this is fixed in 308c6d0e1f200fd26c71270c6e6bfcf0fc6ff082 (fixed)
Vendor states this is fixed in 6c32496964da0dc230cea763a0e934b2e02dabd5 (fixed)
Vendor states this is fixed in d6a597450e686d4c6388bd3cdcb17224b4dae7f0 (fixed)
Vendor states this is fixed in e2b2f0e2e34d71ae6c2a1114fd3c525930e84bc7 (fixed)
Vendor states this is fixed in e7e3e90d671078455a3a08189f89d85b3da2de9e (fixed)
Vendor states this is fixed in eeaa345e128515135ccb864c04482180c08e3259 (fixed)
Vendor states this is fixed in 3.1 (unaffected)
Vendor states this is fixed in 4.14.288 (unaffected)
Vendor states this is fixed in 4.19.252 (unaffected)
Vendor states this is fixed in 4.9.323 (unaffected)
Vendor states this is fixed in 5.10.130 (unaffected)
Vendor states this is fixed in 5.15.54 (unaffected)
Vendor states this is fixed in 5.18.8 (unaffected)
Vendor states this is fixed in 5.19 (unaffected)
Vendor states this is fixed in 5.4.205 (unaffected)

References (8)

Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/0515cc9b6b24877f59b222ade704bfaa42caa2a6
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/197e257da473c725dfe47759c3ee02f2398d8ea5
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/308c6d0e1f200fd26c71270c6e6bfcf0fc6ff082
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/6c32496964da0dc230cea763a0e934b2e02dabd5
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/d6a597450e686d4c6388bd3cdcb17224b4dae7f0
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/e2b2f0e2e34d71ae6c2a1114fd3c525930e84bc7
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/e7e3e90d671078455a3a08189f89d85b3da2de9e
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/eeaa345e128515135ccb864c04482180c08e3259

SSVC — Action Prioritization

SSVCNo known exploitNot automatableTotal impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

7.8HIGHLinux
Vector?

Quick Info

StatusANALYZED
CWE
CWE-416

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card