Vulnerability · Published Feb 10, 2025 · Assigned by Linux

CVE-2025-21693mm: zswap: properly synchronize freeing resources during CPU hotunplug

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.2% (higher than 10% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.2%top 89.6% 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: zswap: properly synchronize freeing resources during CPU hotunplug In zswap_compress() and zswap_decompress(), the per-CPU acomp_ctx of the current CPU at the beginning of the operation is retrieved and used throughout. However, since neither preemption nor migration are disabled, it is possible that the operation continues on a different CPU. If the original CPU is hotunplugged while the acomp_ctx is still in use, we run into a UAF bug as some of the resources attached to the acomp_ctx are freed during hotunplug in zswap_cpu_comp_dead() (i.e. acomp_ctx.buffer, acomp_ctx.req, or acomp_ctx.acomp). The problem was introduced in commit 1ec3b5fe6eec ("mm/zswap: move to use crypto_acomp API for hardware acceleration") when the switch to the crypto_acomp API was made. Prior to that, the per-CPU crypto_comp was retrieved using get_cpu_ptr() which disables preemption and makes sure the CPU cannot go away from under us. Preemption cannot be disabled with the crypto_acomp API as a sleepable context is needed. Use the acomp_ctx.mutex to synchronize CPU hotplug callbacks allocating and freeing resources with compression/decompression paths. Make sure that acomp_ctx.req is NULL when the resources are freed. In the compression/decompression paths, check if acomp_ctx.req is NULL after acquiring the mutex (meaning the CPU was offlined) and retry on the new CPU. The initialization of acomp_ctx.mutex is moved from the CPU hotplug callback to the pool initialization where it belongs (where the mutex is allocated). In addition to adding clarity, this makes sure that CPU hotplug cannot reinitialize a mutex that is already locked by compression/decompression. Previously a fix was attempted by holding cpus_read_lock() [1]. This would have caused a potential deadlock as it is possible for code already holding the lock to fall into reclaim and enter zswap (causing a deadlock). A fix was also attempted using SRCU for synchronization, but Johannes pointed out that synchronize_srcu() cannot be used in CPU hotplug notifiers [2]. Alternative fixes that were considered/attempted and could have worked: - Refcounting the per-CPU acomp_ctx. This involves complexity in handling the race between the refcount dropping to zero in zswap_[de]compress() and the refcount being re-initialized when the CPU is onlined. - Disabling migration before getting the per-CPU acomp_ctx [3], but that's discouraged and is a much bigger hammer than needed, and could result in subtle performance issues. [1]https://lkml.kernel.org/20241219212437.2714151-1-yosryahmed@google.com/ [2]https://lkml.kernel.org/20250107074724.1756696-2-yosryahmed@google.com/ [3]https://lkml.kernel.org/20250107222236.2715883-2-yosryahmed@google.com/ [yosryahmed@google.com: remove comment]

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:10kernel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-devel-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-debug-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-devel-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-64k-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-abi-stablelists6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-cross-headers6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-devel-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-debug-uki-virt6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-devel-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-doc6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-headers6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-modules-extra-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-debug-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-64k-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-debug-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-rt-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-tools6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-tools-libs6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-tools-libs-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-uki-virt6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-uki-virt-addons6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-devel6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-devel-matched6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-modules6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-modules-core6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10kernel-zfcpdump-modules-extra6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10libperf6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10perf6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10python3-perf6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10rtla6.12.0-124.8.1.el10_1ALSA-2025:20095
AlmaLinux:10rv6.12.0-124.8.1.el10_1ALSA-2025:20095
Debian:12linuxno fix listedDEBIAN-CVE-2025-21693
Debian:13linux6.12.12-1DEBIAN-CVE-2025-21693
Debian:14linux6.12.12-1DEBIAN-CVE-2025-21693
Rocky Linux:10kernel0:6.12.0-124.8.1.el10_1RLSA-2025:20095
Ubuntu:22.04:LTSlinuxno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinuxno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-awsno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-awsno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-aws-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azureno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-azureno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1013.13~24.04.1UBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1013.13~24.04.1USN-7448-1
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-fdeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-azure-fdeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-azure-fde-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-azure-nvidiano fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gcpno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-gcpno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-gcp-6.116.11.0-1013.13~24.04.1UBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gcp-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gkeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-gkeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-gkeopno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-gkeopno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-hwe-6.116.11.0-24.24~24.04.1USN-7445-1
Ubuntu:24.04:LTSlinux-hwe-6.116.11.0-24.24~24.04.1UBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-hwe-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-ibmno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-ibmno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-ibm-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-intelno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-intel-iot-realtimeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-intel-iotgno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-kvmno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-lowlatencyno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-lowlatencyno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-lowlatency-hwe-6.116.11.0-1012.13~24.04.1USN-7445-1
Ubuntu:24.04:LTSlinux-lowlatency-hwe-6.116.11.0-1012.13~24.04.1UBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidiano fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-nvidiano fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-nvidia-6.116.11.0-1007.7UBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidia-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-nvidia-lowlatencyno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidia-tegrano fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-nvidia-tegra6.8.0-1035.38USN-8781-1
Ubuntu:24.04:LTSlinux-nvidia-tegra6.8.0-1035.38UBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-nvidia-tegra-igxno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1020.20UBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1020.20USN-7445-1
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-oem-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oracleno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-oracleno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-oracle-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-raspino fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-raspino fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-riscv-6.8no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-vmwareno fix listedUBUNTU-CVE-2025-21693
Ubuntu:24.04:LTSlinux-xilinxno fix listedUBUNTU-CVE-2025-21693
Ubuntu:22.04:LTSlinux-xilinx-zynqmpno fix listedUBUNTU-CVE-2025-21693

Affected products (as reported)

VendorProductVersions
Linux Linux 1ec3b5fe6eec782f4e5e0a80e4ce1909ffd5d161 – before 8d29ff5d50304daa41dc3cfdda4a9d1e46cf5be11ec3b5fe6eec782f4e5e0a80e4ce1909ffd5d161 – before 12dcb0ef540629a281533f9dedc1b6b8e14cfb65
Linux Linux 5.11

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

References