Fixed
Created: Jul 20, 2025
Updated: Sep 1, 2025
Resolved Date: Jul 20, 2025
Found In Version: 10.25.33.1
Severity: Standard
Applicable for: Wind River Linux LTS 25
Component/s: Kernel
In the Linux kernel, the following vulnerability has been resolved:EOL][EOL]eventpoll: don't decrement ep refcount while still holding the ep mutex[EOL][EOL]Jann Horn points out that epoll is decrementing the ep refcount and then[EOL]doing a[EOL][EOL] mutex_unlock(&ep->mtx);[EOL][EOL]afterwards. That's very wrong, because it can lead to a use-after-free.[EOL][EOL]That pattern is actually fine for the very last reference, because the[EOL]code in question will delay the actual call to "ep_free(ep)" until after[EOL]it has unlocked the mutex.[EOL][EOL]But it's wrong for the much subtler "next to last" case when somebody[EOL]*else* may also be dropping their reference and free the ep while we're[EOL]still using the mutex.[EOL][EOL]Note that this is true even if that other user is also using the same ep[EOL]mutex: mutexes, unlike spinlocks, can not be used for object ownership,[EOL]even if they guarantee mutual exclusion.[EOL][EOL]A mutex "unlock" operation is not atomic, and as one user is still[EOL]accessing the mutex as part of unlocking it, another user can come in[EOL]and get the now released mutex and free the data structure while the[EOL]first user is still cleaning up.[EOL][EOL]See our mutex documentation in Documentation/locking/mutex-design.rst,[EOL]in particular the section [1] about semantics:[EOL][EOL]\t"mutex_unlock() may access the mutex structure even after it has[EOL]\t internally released the lock already - so it's not safe for[EOL]\t another context to acquire the mutex and assume that the[EOL]\t mutex_unlock() context is not using the structure anymore"[EOL][EOL]So if we drop our ep ref before the mutex unlock, but we weren't the[EOL]last one, we may then unlock the mutex, another user comes in, drops[EOL]_their_ reference and releases the 'ep' as it now has no users - all[EOL]while the mutex_unlock() is still accessing it.[EOL][EOL]Fix this by simply moving the ep refcount dropping to outside the mutex:[EOL]the refcount itself is atomic, and doesn't need mutex protection (that's[EOL]the whole _point_ of refcounts: unlike mutexes, they are inherently[EOL]about object lifetimes).
CREATE(Triage):(User=admin) [CVE-2025-38349 (https://nvd.nist.gov/vuln/detail/CVE-2025-38349)