Vulnerability · Published Feb 26, 2025 · Assigned by Linux

CVE-2022-49700mm/slub: add missing TID updates on slab deactivation

High 7.8

In plain English

A high-severity use-after-free in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 22% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.3%top 78.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official 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 packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux5.18.14-1DEBIAN-CVE-2022-49700
Debian:13linux5.18.14-1DEBIAN-CVE-2022-49700
Debian:14linux5.18.14-1DEBIAN-CVE-2022-49700
Rocky Linux:8kernel0:4.18.0-553.123.1.el8_10.cloud.0.1RXSA-2024:3138
Ubuntu:22.04:LTSlinux5.15.0-50.56UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-aws5.15.0-1021.25UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure5.15.0-1021.26UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1024.30.1UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gcp5.15.0-1019.25UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gke5.15.0-1017.20UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1004.6UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-ibm5.15.0-1015.17UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-intel-iot-realtimeno fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1017.22UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-kvm5.15.0-1019.23UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-50.56UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1015.15UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oracle5.15.0-1019.24UBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-raspi5.15.0-1016.18UBUNTU-CVE-2022-49700
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2022-49700
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2022-49700

Affected products (as reported)

VendorProductVersions
Linux Linux 03e404af26dc2ea0d278d7a342de0aab394793ce – before 308c6d0e1f200fd26c71270c6e6bfcf0fc6ff08203e404af26dc2ea0d278d7a342de0aab394793ce – before d6a597450e686d4c6388bd3cdcb17224b4dae7f003e404af26dc2ea0d278d7a342de0aab394793ce – before e2b2f0e2e34d71ae6c2a1114fd3c525930e84bc703e404af26dc2ea0d278d7a342de0aab394793ce – before e7e3e90d671078455a3a08189f89d85b3da2de9e03e404af26dc2ea0d278d7a342de0aab394793ce – before 6c32496964da0dc230cea763a0e934b2e02dabd503e404af26dc2ea0d278d7a342de0aab394793ce – before 0515cc9b6b24877f59b222ade704bfaa42caa2a603e404af26dc2ea0d278d7a342de0aab394793ce – before 197e257da473c725dfe47759c3ee02f2398d8ea503e404af26dc2ea0d278d7a342de0aab394793ce – before eeaa345e128515135ccb864c04482180c08e3259
Linux Linux 3.1

Weakness: CWE-416 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References