summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/lib/x86_64
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-11-17 11:50:23 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2022-11-17 11:51:09 -0500
commit771a579c6e74f305eff97752d91e9b05c4e46323 (patch)
treee291aeae462e3aed281e2b909bfd765a6801522e /tools/testing/selftests/kvm/lib/x86_64
parenteb298605705a5c6b3d61c754e3c80ac8ef8e8724 (diff)
parent05311ce954aebe75935d9ae7d38ac82b5b796e33 (diff)
downloadlinux-771a579c6e74f305eff97752d91e9b05c4e46323.tar.bz2
Merge branch 'kvm-svm-harden' into HEAD
This fixes three issues in nested SVM: 1) in the shutdown_interception() vmexit handler we call kvm_vcpu_reset(). However, if running nested and L1 doesn't intercept shutdown, the function resets vcpu->arch.hflags without properly leaving the nested state. This leaves the vCPU in inconsistent state and later triggers a kernel panic in SVM code. The same bug can likely be triggered by sending INIT via local apic to a vCPU which runs a nested guest. On VMX we are lucky that the issue can't happen because VMX always intercepts triple faults, thus triple fault in L2 will always be redirected to L1. Plus, handle_triple_fault() doesn't reset the vCPU. INIT IPI can't happen on VMX either because INIT events are masked while in VMX mode. Secondarily, KVM doesn't honour SHUTDOWN intercept bit of L1 on SVM. A normal hypervisor should always intercept SHUTDOWN, a unit test on the other hand might want to not do so. Finally, the guest can trigger a kernel non rate limited printk on SVM from the guest, which is fixed as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/x86_64')
-rw-r--r--tools/testing/selftests/kvm/lib/x86_64/processor.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index 65e87b5acb6f..d532c20c74fd 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -1034,19 +1034,6 @@ void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits)
}
}
-struct idt_entry {
- uint16_t offset0;
- uint16_t selector;
- uint16_t ist : 3;
- uint16_t : 5;
- uint16_t type : 4;
- uint16_t : 1;
- uint16_t dpl : 2;
- uint16_t p : 1;
- uint16_t offset1;
- uint32_t offset2; uint32_t reserved;
-};
-
static void set_idt_entry(struct kvm_vm *vm, int vector, unsigned long addr,
int dpl, unsigned short selector)
{