]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'kvm-svm-harden' into HEAD
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Nov 2022 16:42:35 +0000 (11:42 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Nov 2022 16:51:18 +0000 (11:51 -0500)
commit03cd5d9cbb2a9c0f6f83f6b3a8def384be31815d
tree945ba3495bccd5d096519446a6ed6ce1d0db55aa
parent9e255117551ffc66c3f0089ea6e4581808a69b92
parent2658390a923a3031d64123e5f35ced671a51ffb1
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>