# CVE-2025-40065: RISC-V: KVM: Write hgatp register with valid mode bits

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

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **Published:** 2025-10-28T11:48:35.785Z
- **Modified:** 2026-10-30T13:18:12.777Z

## Who should check

- Anyone running Linux \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< feb64ca53d97b3ac8ba9ecbeae5f9426f1513650; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 8b6e327736db013b9e385c3f6f9f0b04ddf26e43; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 5cba8ae00279296a586d0596443109d601b1d116; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< d00b61cd37f4c183ce0edbc9f8ccf6d5430ea357; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 2b351e3d04be9e1533f26c3464f1e44a5beace30
- Anyone running Linux 5.16

## Description

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

RISC-V: KVM: Write hgatp register with valid mode bits

According to the RISC-V Privileged Architecture Spec, when MODE=Bare
is selected,software must write zero to the remaining fields of hgatp.

We have detected the valid mode supported by the HW before, So using a
valid mode to detect how many vmid bits are supported.

## Affected and fixed versions

- Linux: \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< feb64ca53d97b3ac8ba9ecbeae5f9426f1513650; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 8b6e327736db013b9e385c3f6f9f0b04ddf26e43; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 5cba8ae00279296a586d0596443109d601b1d116; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< d00b61cd37f4c183ce0edbc9f8ccf6d5430ea357; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 2b351e3d04be9e1533f26c3464f1e44a5beace30 (cvelist)
- Linux: 5.16 (cvelist)

## Mitigation

- Upgrade Linux to 2b351e3d04be9e1533f26c3464f1e44a5beace30 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-40065. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40065.md
Affected: Linux >= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, < feb64ca53d97b3ac8ba9ecbeae5f9426f1513650; >= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, < 8b6e327736db013b9e385c3f6f9f0b04ddf26e43; >= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, < 5cba8ae00279296a586d0596443109d601b1d116; >= fd7bb4a251dfc1da3496bf5…
Fixed in: Linux 8b6e327736db013b9e385c3f6f9f0b04ddf26e43, Linux 5cba8ae00279296a586d0596443109d601b1d116, Linux 2b351e3d04be9e1533f26c3464f1e44a5beace30

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-40065 being exploited?

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

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

It has no CVSS score yet. Unknown.

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

Linux \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< feb64ca53d97b3ac8ba9ecbeae5f9426f1513650; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 8b6e327736db013b9e385c3f6f9f0b04ddf26e43; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 5cba8ae00279296a586d0596443109d601b1d116; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< d00b61cd37f4c183ce0edbc9f8ccf6d5430ea357; \>= fd7bb4a251dfc1da3496bf59a4793937c13e8c1f, \< 2b351e3d04be9e1533f26c3464f1e44a5beace30; Linux 5.16.

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

Yes. Fixed in Linux 8b6e327736db013b9e385c3f6f9f0b04ddf26e43, Linux 5cba8ae00279296a586d0596443109d601b1d116, Linux 2b351e3d04be9e1533f26c3464f1e44a5beace30. Upgrade Linux to 2b351e3d04be9e1533f26c3464f1e44a5beace30 or later.

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

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/feb64ca53d97b3ac8ba9ecbeae5f9426f1513650>
- other: <https://git.kernel.org/stable/c/8b6e327736db013b9e385c3f6f9f0b04ddf26e43>
- other: <https://git.kernel.org/stable/c/5cba8ae00279296a586d0596443109d601b1d116>
- other: <https://git.kernel.org/stable/c/d00b61cd37f4c183ce0edbc9f8ccf6d5430ea357>
- other: <https://git.kernel.org/stable/c/2b351e3d04be9e1533f26c3464f1e44a5beace30>

## 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-40065>

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