HomeDefectsLIN1025-3318
Fixed

LIN1025-3318 : Security Advisory - linux - CVE-2025-38554

Created: Aug 19, 2025    Updated: Sep 1, 2025
Resolved Date: Aug 25, 2025
Found In Version: 10.25.33.1
Severity: Standard
Applicable for: Wind River Linux LTS 25
Component/s: Kernel

Description

In the Linux kernel, the following vulnerability has been resolved:EOL][EOL]mm: fix a UAF when vma->mm is freed after vma->vm_refcnt got dropped[EOL][EOL]By inducing delays in the right places, Jann Horn created a reproducer for[EOL]a hard to hit UAF issue that became possible after VMAs were allowed to be[EOL]recycled by adding SLAB_TYPESAFE_BY_RCU to their cache.[EOL][EOL]Race description is borrowed from Jann's discovery report:[EOL]lock_vma_under_rcu() looks up a VMA locklessly with mas_walk() under[EOL]rcu_read_lock().  At that point, the VMA may be concurrently freed, and it[EOL]can be recycled by another process.  vma_start_read() then increments the[EOL]vma->vm_refcnt (if it is in an acceptable range), and if this succeeds,[EOL]vma_start_read() can return a recycled VMA.[EOL][EOL]In this scenario where the VMA has been recycled, lock_vma_under_rcu()[EOL]will then detect the mismatching ->vm_mm pointer and drop the VMA through[EOL]vma_end_read(), which calls vma_refcount_put().  vma_refcount_put() drops[EOL]the refcount and then calls rcuwait_wake_up() using a copy of vma->vm_mm. [EOL]This is wrong: It implicitly assumes that the caller is keeping the VMA's[EOL]mm alive, but in this scenario the caller has no relation to the VMA's mm,[EOL]so the rcuwait_wake_up() can cause UAF.[EOL][EOL]The diagram depicting the race:[EOL]T1         T2         T3[EOL]==         ==         ==[EOL]lock_vma_under_rcu[EOL]  mas_walk[EOL]          <VMA gets removed from mm>[EOL]                      mmap[EOL]                        <the same VMA is reallocated>[EOL]  vma_start_read[EOL]    __refcount_inc_not_zero_limited_acquire[EOL]                      munmap[EOL]                        __vma_enter_locked[EOL]                          refcount_add_not_zero[EOL]  vma_end_read[EOL]    vma_refcount_put[EOL]      __refcount_dec_and_test[EOL]                          rcuwait_wait_event[EOL]                            <finish operation>[EOL]      rcuwait_wake_up [UAF][EOL][EOL]Note that rcuwait_wait_event() in T3 does not block because refcount was[EOL]already dropped by T1.  At this point T3 can exit and free the mm causing[EOL]UAF in T1.[EOL][EOL]To avoid this we move vma->vm_mm verification into vma_start_read() and[EOL]grab vma->vm_mm to stabilize it before vma_refcount_put() operation.[EOL][EOL][surenb@google.com: v3]

CREATE(Triage):(User=lchen-cn) [CVE-2025-38554 (https://nvd.nist.gov/vuln/detail/CVE-2025-38554)