CVE-2025-40040
BaseFortify
Publication date: 2025-10-28
Last updated on: 2026-02-26
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | From 6.13 (inc) to 6.17.3 (exc) |
| linux | linux_kernel | From 4.6 (inc) to 5.4.302 (exc) |
| linux | linux_kernel | From 5.11 (inc) to 5.15.197 (exc) |
| linux | linux_kernel | From 5.16 (inc) to 6.1.158 (exc) |
| linux | linux_kernel | From 5.5 (inc) to 5.10.247 (exc) |
| linux | linux_kernel | From 6.2 (inc) to 6.6.114 (exc) |
| linux | linux_kernel | From 6.7 (inc) to 6.12.55 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-UNKNOWN |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability is a flaw in the Linux kernel's memory management subsystem (ksm_madvise) where a specific flag (VM_MERGEABLE) is incorrectly cleared due to a type mismatch during a bitwise operation. When a user calls madvise() with MADV_UNMERGEABLE on a virtual memory area (VMA) registered for userfaultfd (UFFD) in MINOR mode, the upper 32 bits of the vm_flags field are accidentally cleared. This causes an inconsistency detected during userfaultfd_release_all(), leading to a kernel crash (BUG) or warning. The root cause is that VM_MERGEABLE is defined as a 32-bit unsigned int, and the bitwise negation and AND operation do not preserve the upper 32 bits of the 64-bit vm_flags field, resulting in flag loss.
How can this vulnerability impact me? :
This vulnerability can cause the Linux kernel to crash or panic when it detects an inconsistency in userfaultfd flags during memory management operations. Specifically, it can lead to kernel BUGs or warnings, which may result in system instability, unexpected reboots, or denial of service. Systems using userfaultfd with memory areas marked with MADV_UNMERGEABLE in MINOR mode are particularly affected.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability manifests as a kernel BUG or WARNING related to userfaultfd_release_all() in the Linux kernel logs. Detection involves monitoring kernel logs for messages like 'kernel BUG at mm/userfaultfd.c:2067' or 'WARNING: CPU: ... at mm/userfaultfd.c:2067'. You can use commands such as 'dmesg | grep userfaultfd' or 'journalctl -k | grep userfaultfd' to detect these messages. There are no specific network detection commands since this is a kernel memory management issue.
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation involves updating the Linux kernel to a version that includes the fix for the flag-dropping behavior in ksm_madvise, which corrects the handling of VM_MERGEABLE flags. Until the kernel is updated, avoid using madvise() with MADV_UNMERGEABLE on VMAs registered for userfaultfd in MINOR mode to prevent triggering the issue.