CVE-2025-38554

Source
https://cve.org/CVERecord?id=CVE-2025-38554
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-38554.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-38554
Downstream
Related
Published
2025-08-19T17:02:33.315Z
Modified
2026-03-23T05:07:14.823277189Z
Summary
mm: fix a UAF when vma->mm is freed after vma->vm_refcnt got dropped
Details

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 SLABTYPESAFEBY_RCU to their cache.

Race description is borrowed from Jann's discovery report: lockvmaunderrcu() looks up a VMA locklessly with maswalk() under rcureadlock(). At that point, the VMA may be concurrently freed, and it can be recycled by another process. vmastartread() then increments the vma->vmrefcnt (if it is in an acceptable range), and if this succeeds, vmastart_read() can return a recycled VMA.

In this scenario where the VMA has been recycled, lockvmaunderrcu() will then detect the mismatching ->vmmm pointer and drop the VMA through vmaendread(), which calls vmarefcountput(). vmarefcountput() drops the refcount and then calls rcuwaitwakeup() using a copy of vma->vmmm. 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 rcuwaitwake_up() can cause UAF.

The diagram depicting the race: T1 T2 T3 == == == lockvmaunderrcu maswalk <VMA gets removed from mm> mmap <the same VMA is reallocated> vmastartread __refcountincnot_zerolimitedacquire munmap __vmaenterlocked refcount_addnotzero vmaendread vmarefcountput _refcountdecandtest rcuwaitwaitevent <finish operation> rcuwaitwakeup [UAF]

Note that rcuwaitwaitevent() 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->vmmm verification into vmastartread() and grab vma->vmmm to stabilize it before vmarefcountput() operation.

[surenb@google.com: v3]

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/38xxx/CVE-2025-38554.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
3104138517fc66aad21f4a2487bb572e9fc2e3ec
Fixed
6e88fe54721dee17d3496bc998f0c7d243896348
Fixed
1bcd236a2536a451e385f8d6d2bb589689ec812f
Fixed
9bbffee67ffd16360179327b57f3b1245579ef08

Affected versions

v6.*
v6.14
v6.14-rc7
v6.15
v6.15-rc1
v6.15-rc2
v6.15-rc3
v6.15-rc4
v6.15-rc5
v6.15-rc6
v6.15-rc7
v6.15.1
v6.15.2
v6.15.3
v6.15.4
v6.15.5
v6.15.6
v6.15.7
v6.15.8
v6.15.9
v6.16
v6.16-rc1
v6.16-rc2
v6.16-rc3
v6.16-rc4
v6.16-rc5
v6.16-rc6
v6.16-rc7

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-38554.json"