CVE-2025-40270
JSON

7.8high

mm, swap: fix potential UAF issue for VMA readahead

Severity
7.8high CVSS:3.1 by Linux
Exploit likelihood
0.15% (higher than 4% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm, swap: fix potential UAF issue for VMA readahead Since commit 78524b05f1a3 ("mm, swap: avoid redundant swap device pinning"), the common helper for allocating and preparing a folio in the swap cache layer no longer tries to get a swap device reference internally, because all callers of __read_swap_cache_async are already holding a swap entry reference. The repeated swap device pinning isn't needed on the same swap device. Caller of VMA readahead is also holding a reference to the target entry's swap device, but VMA readahead walks the page table, so it might encounter swap entries from other devices, and call __read_swap_cache_async on another device without holding a reference to it. So it is possible to cause a UAF when swapoff of device A raced with swapin on device B, and VMA readahead tries to read swap entries from device A. It's not easy to trigger, but in theory, it could cause real issues. Make VMA readahead try to get the device reference first if the swap device is a different one from the target entry.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 78524b05f1a3e16a5d00cc9c6259c41a9d6003ce before a4145be7b56bfa87dce56415c3ad993071462b8a, from 78524b05f1a3e16a5d00cc9c6259c41a9d6003ce before 1c2a936edd71e133f2806e68324ec81a4eb07588, 6.15
Not affected: before 6.15, from 6.17.9 up to 6.17.*, from 6.18 up to *
CVE List

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: mm, swap: fix potential UAF issue for VMA readahead Since commit 78524b05f1a3 ("mm, swap: avoid redundant swap device pinning"), the common helper for allocating and preparing a folio in the swap cache layer no longer tries to get a swap device reference internally, because all callers of __read_swap_cache_async are already holding a swap entry reference. The repeated swap device pinning isn't needed on the same swap device. Caller of VMA readahead is also holding a reference to the target entry's swap device, but VMA readahead walks the page table, so it might encounter swap entries from other devices, and call __read_swap_cache_async on another device without holding a reference to it. So it is possible to cause a UAF when swapoff of device A raced with swapin on device B, and VMA readahead tries to read swap entries from device A. It's not easy to trigger, but in theory, it could cause real issues. Make VMA readahead try to get the device reference first if the swap device is a different one from the target entry.

NVD (es)

En el kernel de Linux, la siguiente vulnerabilidad ha sido corregida: mm, swap: corregir posible problema de uso?después?de?liberación (UAF) para VMA readahead Desde el commit?'78524b05f1a3' (“mm, swap: avoid redundant swap device pinning”), el helper común para asignar y preparar un folio en la capa de caché de swap ya no intenta obtener una referencia al swap device internamente, porque todos los llamadores de '__read_swap_cache_async' ya están manteniendo una referencia a una swap entry. El pinning repetido del swap device no es necesario en el mismo swap device. El llamador de VMA readahead también está manteniendo una referencia al swap device de la entrada objetivo, pero VMA readahead recorre la tabla de páginas, de modo que puede encontrarse con swap entries de otros dispositivos y llamar a '__read_swap_cache_async' sobre otro dispositivo sin mantener una referencia a él. Por lo tanto, es posible provocar un uso?después?de?liberación cuando 'swapoff' del dispositivo?A compite con 'swapin' en el dispositivo?B, y VMA readahead intenta leer swap entries del dispositivo?A. No es fácil de desencadenar, pero en teoría podría causar problemas reales. Hacer que VMA readahead intente obtener primero la referencia al dispositivo si el swap device es diferente al del target entry.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-40270 changed 2026-08-05CVE Terms of Use
NVDCVE-2025-40270 changed 2026-10-15Public domain