# CVE-2025-40038: KVM: SVM: Skip fastpath emulation on VM-Exit if next RIP isn't valid

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.1
- **CVSS:** 7.1 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Changed (impact reaches other components); Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.25% (percentile 10, 2026-11-28)
- **Published:** 2025-10-28T11:48:18.889Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= b439eb8ab578557263815ba8581d02c1b730e348, \< cd3efb93677c4b0cf76348882fb429165fee33fd; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< f994e9c790ce97d3cf01af4d0a1b9add0c955aee; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< da2a3c231f7f2a5ac146d972b8c1d7d84aff6d70; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c
- Anyone running Linux 6.5

## Description

In the Linux kernel, the following vulnerability has been resolved:

KVM: SVM: Skip fastpath emulation on VM-Exit if next RIP isn't valid

Skip the WRMSR and HLT fastpaths in SVM's VM-Exit handler if the next RIP
isn't valid, e.g. because KVM is running with nrips=false.  SVM must
decode and emulate to skip the instruction if the CPU doesn't provide the
next RIP, and getting the instruction bytes to decode requires reading
guest memory.  Reading guest memory through the emulator can fault, i.e.
can sleep, which is disallowed since the fastpath handlers run with IRQs
disabled.

 BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:106
 in\_atomic(): 1, irqs\_disabled(): 1, non\_block: 0, pid: 32611, name: qemu
 preempt\_count: 1, expected: 0
 INFO: lockdep is turned off.
 irq event stamp: 30580
 hardirqs last  enabled at (30579): \[\<ffffffffc08b2527\>\] vcpu\_run+0x1787/0x1db0 \[kvm\]
 hardirqs last disabled at (30580): \[\<ffffffffb4f62e32\>\] \_\_schedule+0x1e2/0xed0
 softirqs last  enabled at (30570): \[\<ffffffffb4247a64\>\] fpu\_swap\_kvm\_fpstate+0x44/0x210
 softirqs last disabled at (30568): \[\<ffffffffb4247a64\>\] fpu\_swap\_kvm\_fpstate+0x44/0x210
 CPU: 298 UID: 0 PID: 32611 Comm: qemu Tainted: G     U              6.16.0-smp--e6c618b51cfe-sleep \#782 NONE
 Tainted: \[U\]=USER
 Hardware name: Google Astoria-Turin/astoria, BIOS 0.20241223.2-0 01/17/2025
 Call Trace:
  \<TASK\>
  dump\_stack\_lvl+0x7d/0xb0
  \_\_might\_resched+0x271/0x290
  \_\_might\_fault+0x28/0x80
  kvm\_vcpu\_read\_guest\_page+0x8d/0xc0 \[kvm\]
  kvm\_fetch\_guest\_virt+0x92/0xc0 \[kvm\]
  \_\_do\_insn\_fetch\_bytes+0xf3/0x1e0 \[kvm\]
  x86\_decode\_insn+0xd1/0x1010 \[kvm\]
  x86\_emulate\_instruction+0x105/0x810 \[kvm\]
  \_\_svm\_skip\_emulated\_instruction+0xc4/0x140 \[kvm\_amd\]
  handle\_fastpath\_invd+0xc4/0x1a0 \[kvm\]
  vcpu\_run+0x11a1/0x1db0 \[kvm\]
  kvm\_arch\_vcpu\_ioctl\_run+0x5cc/0x730 \[kvm\]
  kvm\_vcpu\_ioctl+0x578/0x6a0 \[kvm\]
  \_\_se\_sys\_ioctl+0x6d/0xb0
  do\_syscall\_64+0x8a/0x2c0
  entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53
 RIP: 0033:0x7f479d57a94b
  \</TASK\>

Note, this is essentially a reapply of commit 5c30e8101e8d ("KVM: SVM:
Skip WRMSR fastpath on VM-Exit if next RIP isn't valid"), but with
different justification (KVM now grabs SRCU when skipping the instruction
for other reasons).

## Affected and fixed versions

- Linux: \>= b439eb8ab578557263815ba8581d02c1b730e348, \< cd3efb93677c4b0cf76348882fb429165fee33fd; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< f994e9c790ce97d3cf01af4d0a1b9add0c955aee; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< da2a3c231f7f2a5ac146d972b8c1d7d84aff6d70; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c (cvelist)
- Linux: 6.5 (cvelist)

## Mitigation

- Upgrade Linux to 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-40038. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40038.md
Affected: Linux >= b439eb8ab578557263815ba8581d02c1b730e348, < cd3efb93677c4b0cf76348882fb429165fee33fd; >= b439eb8ab578557263815ba8581d02c1b730e348, < f994e9c790ce97d3cf01af4d0a1b9add0c955aee; >= b439eb8ab578557263815ba8581d02c1b730e348, < da2a3c231f7f2a5ac146d972b8c1d7d84aff6d70; >= b439eb8ab578557263815ba…
Fixed in: Linux 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-40038 being exploited?

There is no confirmed exploitation: CVE-2025-40038 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.25% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2025-40038?

High: CVSS 7.1 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-40038?

Linux \>= b439eb8ab578557263815ba8581d02c1b730e348, \< cd3efb93677c4b0cf76348882fb429165fee33fd; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< f994e9c790ce97d3cf01af4d0a1b9add0c955aee; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< da2a3c231f7f2a5ac146d972b8c1d7d84aff6d70; \>= b439eb8ab578557263815ba8581d02c1b730e348, \< 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c; Linux 6.5.

### Is there a fix for CVE-2025-40038?

Yes. Fixed in Linux 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c. Upgrade Linux to 0910dd7c9ad45a2605c45fd2bf3d1bcac087687c or later.

### How do I check if I'm affected by CVE-2025-40038?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/cd3efb93677c4b0cf76348882fb429165fee33fd>
- other: <https://git.kernel.org/stable/c/f994e9c790ce97d3cf01af4d0a1b9add0c955aee>
- other: <https://git.kernel.org/stable/c/da2a3c231f7f2a5ac146d972b8c1d7d84aff6d70>
- other: <https://git.kernel.org/stable/c/0910dd7c9ad45a2605c45fd2bf3d1bcac087687c>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-40038>

HTML: <https://flawdb.com/CVE-2025-40038> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-40038>
