CVE-2025-38554
Description
In the Linux kernel, the following vulnerability has been resolved:
mm: fix a UAF when vma->mm is freed after vma->vm_refcnt got dropped
By inducing delays in the right places, Jann Horn created a reproducer for a hard to hit UAF issue that became possible after VMAs were allowed to be recycled by adding SLAB_TYPESAFE_BY_RCU to their cache.
Race description is borrowed from Jann's discovery report: lock_vma_under_rcu() looks up a VMA locklessly with mas_walk() under rcu_read_lock(). At that point, the VMA may be concurrently freed, and it can be recycled by another process. vma_start_read() then increments the vma->vm_refcnt (if it is in an acceptable range), and if this succeeds, vma_start_read() can return a recycled VMA.
In this scenario where the VMA has been recycled, lock_vma_under_rcu() will then detect the mismatching ->vm_mm pointer and drop the VMA through vma_end_read(), which calls vma_refcount_put(). vma_refcount_put() drops the refcount and then calls rcuwait_wake_up() using a copy of vma->vm_mm. This is wrong: It implicitly assumes that the caller is keeping the VMA's mm alive, but in this scenario the caller has no relation to the VMA's mm, so the rcuwait_wake_up() can cause UAF.
The diagram depicting the race: T1 T2 T3 == == == lock_vma_under_rcu mas_walk
mmap
vma_start_read __refcount_inc_not_zero_limited_acquire munmap __vma_enter_locked refcount_add_not_zero vma_end_read vma_refcount_put __refcount_dec_and_test rcuwait_wait_event
rcuwait_wake_up [UAF]
Note that rcuwait_wait_event() in T3 does not block because refcount was already dropped by T1. At this point T3 can exit and free the mm causing UAF in T1.
To avoid this we move vma->vm_mm verification into vma_start_read() and grab vma->vm_mm to stabilize it before vma_refcount_put() operation.
[[email protected]: v3]
Affected products
44- osv-coords41 versionspkg:linux/kernelpkg:rpm/opensuse/dtb-aarch64&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-64kb&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-default&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-default-base&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-docs&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-kvmsmall&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-obs-build&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-obs-qa&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-rt&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-source&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-syms&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/kernel-zfcpdump&distro=openSUSE%20Leap%2016.0pkg:rpm/suse/kernel-64kb&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-64kb&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-64kb&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2016.0pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-default-base&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-default-base&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-default-base&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-docs&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-docs&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-kvmsmall&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-kvmsmall&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-livepatch-SLE16-RT_Update_0&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-livepatch-SLE16_Update_0&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-livepatch-SLE16_Update_0&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-livepatch-SLE16_Update_0&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-obs-qa&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-obs-qa&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-rt&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-source&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-source&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-source&distro=SUSE%20Linux%20Micro%206.2pkg:rpm/suse/kernel-syms&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-syms&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0pkg:rpm/suse/kernel-zfcpdump&distro=SUSE%20Linux%20Enterprise%20Server%2016.0pkg:rpm/suse/kernel-zfcpdump&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20applications%2016.0
>= 6.15.0, < 6.15.10+ 40 more
- (no CPE)range: >= 6.15.0, < 6.15.10
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1.160000.2.4
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1.160000.2.4
- (no CPE)range: < 6.12.0-160000.6.1.160000.2.4
- (no CPE)range: < 6.12.0-160000.6.1.160000.2.4
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 4-160000.3.4
- (no CPE)range: < 5-160000.4.3
- (no CPE)range: < 5-160000.4.3
- (no CPE)range: < 5-160000.4.3
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
- (no CPE)range: < 6.12.0-160000.6.1
Patches
Vulnerability mechanics
References
3News mentions
0No linked articles in our index yet.