# CVE-2024-47717: RISC-V: KVM: Don't zero-out PMU snapshot area before freeing data

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; 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.30% (percentile 15, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2024-10-21T11:53:48.181Z
- **Modified:** 2026-06-17T07:57:37.083Z

## Who should check

- Anyone running Linux \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 6d0a5dcfc78bd18f2abb9641f83380135494559b; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 47d40d93292d9cff8dabb735bed83d930fa03950
- Anyone running Linux 6.10

## Description

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

RISC-V: KVM: Don't zero-out PMU snapshot area before freeing data

With the latest Linux-6.11-rc3, the below NULL pointer crash is observed
when SBI PMU snapshot is enabled for the guest and the guest is forcefully
powered-off.

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000508
  Oops \[\#1\]
  Modules linked in: kvm
  CPU: 0 UID: 0 PID: 61 Comm: term-poll Not tainted 6.11.0-rc3-00018-g44d7178dd77a \#3
  Hardware name: riscv-virtio,qemu (DT)
  epc : \_\_kvm\_write\_guest\_page+0x94/0xa6 \[kvm\]
   ra : \_\_kvm\_write\_guest\_page+0x54/0xa6 \[kvm\]
  epc : ffffffff01590e98 ra : ffffffff01590e58 sp : ffff8f80001f39b0
   gp : ffffffff81512a60 tp : ffffaf80024872c0 t0 : ffffaf800247e000
   t1 : 00000000000007e0 t2 : 0000000000000000 s0 : ffff8f80001f39f0
   s1 : 00007fff89ac4000 a0 : ffffffff015dd7e8 a1 : 0000000000000086
   a2 : 0000000000000000 a3 : ffffaf8000000000 a4 : ffffaf80024882c0
   a5 : 0000000000000000 a6 : ffffaf800328d780 a7 : 00000000000001cc
   s2 : ffffaf800197bd00 s3 : 00000000000828c4 s4 : ffffaf800248c000
   s5 : ffffaf800247d000 s6 : 0000000000001000 s7 : 0000000000001000
   s8 : 0000000000000000 s9 : 00007fff861fd500 s10: 0000000000000001
   s11: 0000000000800000 t3 : 00000000000004d3 t4 : 00000000000004d3
   t5 : ffffffff814126e0 t6 : ffffffff81412700
  status: 0000000200000120 badaddr: 0000000000000508 cause: 000000000000000d
  \[\<ffffffff01590e98\>\] \_\_kvm\_write\_guest\_page+0x94/0xa6 \[kvm\]
  \[\<ffffffff015943a6\>\] kvm\_vcpu\_write\_guest+0x56/0x90 \[kvm\]
  \[\<ffffffff015a175c\>\] kvm\_pmu\_clear\_snapshot\_area+0x42/0x7e \[kvm\]
  \[\<ffffffff015a1972\>\] kvm\_riscv\_vcpu\_pmu\_deinit.part.0+0xe0/0x14e \[kvm\]
  \[\<ffffffff015a2ad0\>\] kvm\_riscv\_vcpu\_pmu\_deinit+0x1a/0x24 \[kvm\]
  \[\<ffffffff0159b344\>\] kvm\_arch\_vcpu\_destroy+0x28/0x4c \[kvm\]
  \[\<ffffffff0158e420\>\] kvm\_destroy\_vcpus+0x5a/0xda \[kvm\]
  \[\<ffffffff0159930c\>\] kvm\_arch\_destroy\_vm+0x14/0x28 \[kvm\]
  \[\<ffffffff01593260\>\] kvm\_destroy\_vm+0x168/0x2a0 \[kvm\]
  \[\<ffffffff015933d4\>\] kvm\_put\_kvm+0x3c/0x58 \[kvm\]
  \[\<ffffffff01593412\>\] kvm\_vm\_release+0x22/0x2e \[kvm\]

Clearly, the kvm\_vcpu\_write\_guest() function is crashing because it is
being called from kvm\_pmu\_clear\_snapshot\_area() upon guest tear down.

To address the above issue, simplify the kvm\_pmu\_clear\_snapshot\_area() to
not zero-out PMU snapshot area from kvm\_pmu\_clear\_snapshot\_area() because
the guest is anyway being tore down.

The kvm\_pmu\_clear\_snapshot\_area() is also called when guest changes
PMU snapshot area of a VCPU but even in this case the previous PMU
snaphsot area must not be zeroed-out because the guest might have
reclaimed the pervious PMU snapshot area for some other purpose.

## Affected and fixed versions

- Linux: \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 6d0a5dcfc78bd18f2abb9641f83380135494559b; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 47d40d93292d9cff8dabb735bed83d930fa03950 (cvelist)
- Linux: 6.10 (cvelist)

## Mitigation

- Upgrade Linux to 47d40d93292d9cff8dabb735bed83d930fa03950 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2024-47717.md
Affected: Linux >= c2f41ddbcdd75689d9f512638a40263e3127be93, < 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a; >= c2f41ddbcdd75689d9f512638a40263e3127be93, < 6d0a5dcfc78bd18f2abb9641f83380135494559b; >= c2f41ddbcdd75689d9f512638a40263e3127be93, < 47d40d93292d9cff8dabb735bed83d930fa03950; Linux 6.10
Fixed in: Linux 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a, Linux 6d0a5dcfc78bd18f2abb9641f83380135494559b, Linux 47d40d93292d9cff8dabb735bed83d930fa03950

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-2024-47717 being exploited?

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

### How serious is CVE-2024-47717?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-47717?

Linux \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 6d0a5dcfc78bd18f2abb9641f83380135494559b; \>= c2f41ddbcdd75689d9f512638a40263e3127be93, \< 47d40d93292d9cff8dabb735bed83d930fa03950; Linux 6.10.

### Is there a fix for CVE-2024-47717?

Yes. Fixed in Linux 81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a, Linux 6d0a5dcfc78bd18f2abb9641f83380135494559b, Linux 47d40d93292d9cff8dabb735bed83d930fa03950. Upgrade Linux to 47d40d93292d9cff8dabb735bed83d930fa03950 or later.

### How do I check if I'm affected by CVE-2024-47717?

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

- patch: <https://git.kernel.org/stable/c/81aa95fd5bd14ff49617f07fa79a8d1f1cf2ce9a>
- patch: <https://git.kernel.org/stable/c/6d0a5dcfc78bd18f2abb9641f83380135494559b>
- patch: <https://git.kernel.org/stable/c/47d40d93292d9cff8dabb735bed83d930fa03950>

## 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-2024-47717>

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