CVE-2025-38349
eventpoll: don't decrement ep refcount while still holding the ep mutex
Check your servers for CVE-2025-38349
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-38349 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
eventpoll: don't decrement ep refcount while still holding the ep mutex
Jann Horn points out that epoll is decrementing the ep refcount and then doing a
mutex_unlock(&ep->mtx);
afterwards. That's very wrong, because it can lead to a use-after-free.
That pattern is actually fine for the very last reference, because the code in question will delay the actual call to "ep_free(ep)" until after it has unlocked the mutex.
But it's wrong for the much subtler "next to last" case when somebody *else* may also be dropping their reference and free the ep while we're still using the mutex.
Note that this is true even if that other user is also using the same ep mutex: mutexes, unlike spinlocks, can not be used for object ownership, even if they guarantee mutual exclusion.
A mutex "unlock" operation is not atomic, and as one user is still accessing the mutex as part of unlocking it, another user can come in and get the now released mutex and free the data structure while the first user is still cleaning up.
See our mutex documentation in Documentation/locking/mutex-design.rst, in particular the section [1] about semantics:
"mutex_unlock() may access the mutex structure even after it has internally released the lock already - so it's not safe for another context to acquire the mutex and assume that the mutex_unlock() context is not using the structure anymore"
So if we drop our ep ref before the mutex unlock, but we weren't the last one, we may then unlock the mutex, another user comes in, drops _their_ reference and releases the 'ep' as it now has no users - all while the mutex_unlock() is still accessing it.
Fix this by simply moving the ep refcount dropping to outside the mutex: the refcount itself is atomic, and doesn't need mutex protection (that's the whole _point_ of refcounts: unlike mutexes, they are inherently about object lifetimes).
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.19%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 8.89% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 10 Jun 2026):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from f2451def095c1743adcfcb0cb5dadc86034e162a, before 263f5de8302a6f2f136d392e5d3f8b1edf922857 affected from a1f93804449d13f97dabd4b996817de4bf1ed67a, before b0821ec902d39062356cb644c16e17a705d1c9f5 affected from 58c9b016e12855286370dfb704c08498edbc857a, before 521e9ff0b67c66a17d6f9593dfccafaa984aae4c affected from 58c9b016e12855286370dfb704c08498edbc857a, before 6dee745bd0aec9d399df674256e7b1ecdb615444 affected from 58c9b016e12855286370dfb704c08498edbc857a, before 605c18698ecfa99165f36b7f59d3ed503e169814 affected from 58c9b016e12855286370dfb704c08498edbc857a, before 8c2e52ebbe885c7eeaabd3b7ddcdc1246fc400d2 affected from 5.15.209, before 5.15.222 affected from 6.1.175, before 6.1.178
Other versions: unaffected
|
| Linux |
affected 6.4 unaffected before 6.4 unaffected from 5.15.222 up to and including 5.15.* unaffected from 6.1.178 up to and including 6.1.* unaffected from 6.6.99 up to and including 6.6.* unaffected from 6.12.39 up to and including 6.12.* unaffected from 6.15.7 up to and including 6.15.* unaffected 6.16 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-38349 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-38349
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-38349
trivy image --scanners vuln IMAGE | grep CVE-2025-38349
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/263f5de8302a6f2f136d392e5d3f8b1edf922857 git.kernel.org
- https://git.kernel.org/stable/c/b0821ec902d39062356cb644c16e17a705d1c9f5 git.kernel.org
- https://git.kernel.org/stable/c/521e9ff0b67c66a17d6f9593dfccafaa984aae4c git.kernel.org
- https://git.kernel.org/stable/c/6dee745bd0aec9d399df674256e7b1ecdb615444 git.kernel.org
- https://git.kernel.org/stable/c/605c18698ecfa99165f36b7f59d3ed503e169814 git.kernel.org
- https://git.kernel.org/stable/c/8c2e52ebbe885c7eeaabd3b7ddcdc1246fc400d2 git.kernel.org
- https://project-zero.issues.chromium.org/issues/430541637 project-zero.issues.chromium.org
Source: the record CVE-2025-38349 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse