CVE-2024-47717

Severity CVSS v4.0:
Pending analysis
Type:
CWE-476 NULL Pointer Dereference
Publication date:
21/10/2024
Last modified:
24/10/2024

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> RISC-V: KVM: Don&amp;#39;t zero-out PMU snapshot area before freeing data<br /> <br /> With the latest Linux-6.11-rc3, the below NULL pointer crash is observed<br /> when SBI PMU snapshot is enabled for the guest and the guest is forcefully<br /> powered-off.<br /> <br /> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000508<br /> Oops [#1]<br /> Modules linked in: kvm<br /> CPU: 0 UID: 0 PID: 61 Comm: term-poll Not tainted 6.11.0-rc3-00018-g44d7178dd77a #3<br /> Hardware name: riscv-virtio,qemu (DT)<br /> epc : __kvm_write_guest_page+0x94/0xa6 [kvm]<br /> ra : __kvm_write_guest_page+0x54/0xa6 [kvm]<br /> epc : ffffffff01590e98 ra : ffffffff01590e58 sp : ffff8f80001f39b0<br /> gp : ffffffff81512a60 tp : ffffaf80024872c0 t0 : ffffaf800247e000<br /> t1 : 00000000000007e0 t2 : 0000000000000000 s0 : ffff8f80001f39f0<br /> s1 : 00007fff89ac4000 a0 : ffffffff015dd7e8 a1 : 0000000000000086<br /> a2 : 0000000000000000 a3 : ffffaf8000000000 a4 : ffffaf80024882c0<br /> a5 : 0000000000000000 a6 : ffffaf800328d780 a7 : 00000000000001cc<br /> s2 : ffffaf800197bd00 s3 : 00000000000828c4 s4 : ffffaf800248c000<br /> s5 : ffffaf800247d000 s6 : 0000000000001000 s7 : 0000000000001000<br /> s8 : 0000000000000000 s9 : 00007fff861fd500 s10: 0000000000000001<br /> s11: 0000000000800000 t3 : 00000000000004d3 t4 : 00000000000004d3<br /> t5 : ffffffff814126e0 t6 : ffffffff81412700<br /> status: 0000000200000120 badaddr: 0000000000000508 cause: 000000000000000d<br /> [] __kvm_write_guest_page+0x94/0xa6 [kvm]<br /> [] kvm_vcpu_write_guest+0x56/0x90 [kvm]<br /> [] kvm_pmu_clear_snapshot_area+0x42/0x7e [kvm]<br /> [] kvm_riscv_vcpu_pmu_deinit.part.0+0xe0/0x14e [kvm]<br /> [] kvm_riscv_vcpu_pmu_deinit+0x1a/0x24 [kvm]<br /> [] kvm_arch_vcpu_destroy+0x28/0x4c [kvm]<br /> [] kvm_destroy_vcpus+0x5a/0xda [kvm]<br /> [] kvm_arch_destroy_vm+0x14/0x28 [kvm]<br /> [] kvm_destroy_vm+0x168/0x2a0 [kvm]<br /> [] kvm_put_kvm+0x3c/0x58 [kvm]<br /> [] kvm_vm_release+0x22/0x2e [kvm]<br /> <br /> Clearly, the kvm_vcpu_write_guest() function is crashing because it is<br /> being called from kvm_pmu_clear_snapshot_area() upon guest tear down.<br /> <br /> To address the above issue, simplify the kvm_pmu_clear_snapshot_area() to<br /> not zero-out PMU snapshot area from kvm_pmu_clear_snapshot_area() because<br /> the guest is anyway being tore down.<br /> <br /> The kvm_pmu_clear_snapshot_area() is also called when guest changes<br /> PMU snapshot area of a VCPU but even in this case the previous PMU<br /> snaphsot area must not be zeroed-out because the guest might have<br /> reclaimed the pervious PMU snapshot area for some other purpose.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.10 (including) 6.10.13 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.11 (including) 6.11.2 (excluding)