CVE-2025-40040: Linux kernel · mm/ksm: fix flag-dropping behavior in ksm_madvise
Affects Linux kernelSource GCVE Database
Not known to be exploited · CVSS 7.8 High · fixed in 5.15.0-1103.110~20.04.1 : patch Linux kernel soon.
Data as of 26 Oct 2026, 13:47 UTC
- EPSS
- 0.3% chance of exploitation in 30 days – higher than 31% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
- Patch
- Available – fixed in 5.15.0-1103.110~20.04.1, 5.15.0-1110.119~20.04.1, 5.15.0-1103.112~20.04.1 +36
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HExploitation evidence
Disclosed: evidence found.
CVE published 28 Oct 2025
Detectable: no evidence on record.
No public nuclei template indexed
Weaponised: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.
What to do
Upgrade to a fixed release listed under Affected software.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
Ubuntu 25.10linuxpkg:deb/ubuntu/linux@6.17.0-14.14?arch=source&distro=questingOther threats | Affected
| Fixed in
|
Ubuntu 25.10linux-awspkg:deb/ubuntu/linux-aws@6.17.0-1007.7?arch=source&distro=questingOther threats | Affected
| Fixed in
|
Ubuntu 25.10linux-azurepkg:deb/ubuntu/linux-azure@6.17.0-1008.8?arch=source&distro=questingOther threats | Affected
| Fixed in
|
Ubuntu 25.10linux-azure-fdepkg:deb/ubuntu/linux-azure-fde@6.17.0-1017.17?arch=source&distro=questingOther threats | Affected
| Fixed in– |
Ubuntu 25.10linux-gcppkg:deb/ubuntu/linux-gcp@6.17.0-1007.7?arch=source&distro=questingOther threats | Affected
| Fixed in
|
Ubuntu 25.10linux-oraclepkg:deb/ubuntu/linux-oracle@6.17.0-1007.7?arch=source&distro=questingOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
An official patch is available and included in Linux kernel updates. Users should apply the latest kernel updates from their distribution to remediate this issue. The Ubuntu advisory USN-8029-1 confirms that this and other kernel vulnerabilities have been fixed in updated packages. No additional mitigation steps are required beyond applying the official fixes.
Description
A vulnerability in the Linux kernel's memory management subsystem (mm/ksm) involving improper flag handling in the ksm_madvise function was discovered and fixed. The issue caused a kernel crash due to inconsistent userfaultfd flags when madvise() is called with MADV_UNMERGEABLE on a VMA registered for userfaultfd in MINOR mode. This was due to incorrect bitwise operations on a 64-bit flag field caused by a 32-bit constant. The flaw was corrected by changing the VM_MERGEABLE constant to an unsigned long type. This vulnerability has a CVSS score of 7.8 and affects multiple Linux kernel versions. A patch is available and included in official Linux kernel updates.
References
- ubuntu.com/security/CVE-2025-40040 (opens in a new tab)
- cve.org/CVERecord?id=CVE-2025-40040 (opens in a new tab)
- git.kernel.org/linus/f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93 (opens in a new tab)
- git.kernel.org/stable/c/76385629f45740b7888f8fcd83bde955b10f61fe (opens in a new tab)
- git.kernel.org/stable/c/92b82e232b8d8b116ac6e57aeae7a6033db92c60 (opens in a new tab)
- git.kernel.org/stable/c/ac50c6e0a8f91a02b681af81abb2362fbb67cc18 (opens in a new tab)
- git.kernel.org/stable/c/f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93 (opens in a new tab)
- ubuntu.com/security/notices/USN-8029-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8030-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8029-2 (opens in a new tab)
- ubuntu.com/security/notices/USN-8048-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8029-3 (opens in a new tab)
- ubuntu.com/security/notices/USN-8096-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8096-2 (opens in a new tab)
- ubuntu.com/security/notices/USN-8096-3 (opens in a new tab)
- ubuntu.com/security/notices/USN-8096-4 (opens in a new tab)
- ubuntu.com/security/notices/USN-8116-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8096-5 (opens in a new tab)
- ubuntu.com/security/notices/USN-8141-1 (opens in a new tab)
- ubuntu.com/security/notices/USN-8163-1 (opens in a new tab)