diff options
author | Sean Christopherson <seanjc@google.com> | 2022-12-13 06:09:12 +0000 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-01-24 10:36:41 -0800 |
commit | 11df586d774f4aab1835144fd2a8dc3cb2add8d4 (patch) | |
tree | 17e072c09eaeff43a5423d88f6e1cd2ba54bcb67 /arch/x86/kvm/x86.h | |
parent | 4f76e86f7e0dc33af14256d30177bf65de2f9cab (diff) | |
download | linux-11df586d774f4aab1835144fd2a8dc3cb2add8d4.tar.gz linux-11df586d774f4aab1835144fd2a8dc3cb2add8d4.tar.bz2 linux-11df586d774f4aab1835144fd2a8dc3cb2add8d4.zip |
KVM: VMX: Handle NMI VM-Exits in noinstr region
Move VMX's handling of NMI VM-Exits into vmx_vcpu_enter_exit() so that
the NMI is handled prior to leaving the safety of noinstr. Handling the
NMI after leaving noinstr exposes the kernel to potential ordering
problems as an instrumentation-induced fault, e.g. #DB, #BP, #PF, etc.
will unblock NMIs when IRETing back to the faulting instruction.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20221213060912.654668-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/x86.h')
-rw-r--r-- | arch/x86/kvm/x86.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 9de72586f406..44d1827f0a30 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -382,13 +382,13 @@ enum kvm_intr_type { KVM_HANDLING_NMI, }; -static inline void kvm_before_interrupt(struct kvm_vcpu *vcpu, - enum kvm_intr_type intr) +static __always_inline void kvm_before_interrupt(struct kvm_vcpu *vcpu, + enum kvm_intr_type intr) { WRITE_ONCE(vcpu->arch.handling_intr_from_guest, (u8)intr); } -static inline void kvm_after_interrupt(struct kvm_vcpu *vcpu) +static __always_inline void kvm_after_interrupt(struct kvm_vcpu *vcpu) { WRITE_ONCE(vcpu->arch.handling_intr_from_guest, 0); } |