diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-08-10 20:18:13 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-08-10 20:18:13 +0100 |
commit | fb9b60f9be008e7c4bc6784f91e5abd987c30bf9 (patch) | |
tree | 7ee753dc8cbe028f1492233a48d559e60528050a | |
parent | a4231780b5d730fa1aed93f7844aee0a90a509ff (diff) | |
download | linux-stable-queue-fb9b60f9be008e7c4bc6784f91e5abd987c30bf9.tar.gz |
Drop "x86/kvm: move kvm_load/put_guest_xcr0 into atomic context" etc.
Several of these require their own fixes. Defer the whole lot for now.
5 files changed, 0 insertions, 314 deletions
diff --git a/queue-3.16/kvm-vmx-handle-vmlaunch-vmresume-failure-properly.patch b/queue-3.16/kvm-vmx-handle-vmlaunch-vmresume-failure-properly.patch deleted file mode 100644 index 703b84c5..00000000 --- a/queue-3.16/kvm-vmx-handle-vmlaunch-vmresume-failure-properly.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Jim Mattson <jmattson@google.com> -Date: Thu, 14 Sep 2017 16:31:42 -0700 -Subject: kvm: vmx: Handle VMLAUNCH/VMRESUME failure properly - -commit b060ca3b2e9e72ef005e2042476f95ee0b8839e9 upstream. - -On an early VMLAUNCH/VMRESUME failure (i.e. one which sets the -VM-instruction error field of the current VMCS), the launch state of -the current VMCS is not set to "launched," and the VM-exit information -fields of the current VMCS (including IDT-vectoring information and -exit reason) are stale. - -On a late VMLAUNCH/VMRESUME failure (i.e. one which sets the high bit -of the exit reason field), the launch state of the current VMCS is not -set to "launched," and only two of the VM-exit information fields of -the current VMCS are modified (exit reason and exit -qualification). The remaining VM-exit information fields of the -current VMCS (including IDT-vectoring information, in particular) are -stale. - -Signed-off-by: Jim Mattson <jmattson@google.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -Signed-off-by: Ben Hutchings <ben@decadent.org.uk> ---- - arch/x86/kvm/vmx.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -7627,12 +7627,6 @@ static void __noclone vmx_vcpu_run(struc - | (1 << VCPU_EXREG_CR3)); - vcpu->arch.regs_dirty = 0; - -- vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); -- -- vmx->loaded_vmcs->launched = 1; -- -- vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); -- - /* - * the KVM_REQ_EVENT optimization bit is only on for one entry, and if - * we did not inject a still-pending event to L1 now because of -@@ -7642,6 +7636,14 @@ static void __noclone vmx_vcpu_run(struc - kvm_make_request(KVM_REQ_EVENT, vcpu); - - vmx->nested.nested_run_pending = 0; -+ vmx->idt_vectoring_info = 0; -+ -+ vmx->exit_reason = vmx->fail ? 0xdead : vmcs_read32(VM_EXIT_REASON); -+ if (vmx->fail || (vmx->exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) -+ return; -+ -+ vmx->loaded_vmcs->launched = 1; -+ vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); - - vmx_complete_atomic_exit(vmx); - vmx_recover_nmi_blocking(vmx); diff --git a/queue-3.16/kvm-x86-move-tracepoints-outside-extended-quiescent-state.patch b/queue-3.16/kvm-x86-move-tracepoints-outside-extended-quiescent-state.patch deleted file mode 100644 index 8654826e..00000000 --- a/queue-3.16/kvm-x86-move-tracepoints-outside-extended-quiescent-state.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Paolo Bonzini <pbonzini@redhat.com> -Date: Thu, 10 Dec 2015 18:37:32 +0100 -Subject: kvm: x86: move tracepoints outside extended quiescent state - -commit 8b89fe1f6c430589122542f228a802d34995bebd upstream. - -Invoking tracepoints within kvm_guest_enter/kvm_guest_exit causes a -lockdep splat. - -Reported-by: Borislav Petkov <bp@alien8.de> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -[bwh: Backported to 3.16: we don't have wait_lapic_expire()] -Signed-off-by: Ben Hutchings <ben@decadent.org.uk> ---- ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -3588,6 +3588,8 @@ static int handle_exit(struct kvm_vcpu * - struct kvm_run *kvm_run = vcpu->run; - u32 exit_code = svm->vmcb->control.exit_code; - -+ trace_kvm_exit(exit_code, vcpu, KVM_ISA_SVM); -+ - if (!is_cr_intercept(svm, INTERCEPT_CR0_WRITE)) - vcpu->arch.cr0 = svm->vmcb->save.cr0; - if (npt_enabled) -@@ -4113,8 +4115,6 @@ static void svm_vcpu_run(struct kvm_vcpu - vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; - vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; - -- trace_kvm_exit(svm->vmcb->control.exit_code, vcpu, KVM_ISA_SVM); -- - if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) - kvm_before_handle_nmi(&svm->vcpu); - ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -7025,6 +7025,8 @@ static int vmx_handle_exit(struct kvm_vc - u32 exit_reason = vmx->exit_reason; - u32 vectoring_info = vmx->idt_vectoring_info; - -+ trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX); -+ - /* If guest state is invalid, start emulating */ - if (vmx->emulation_required) - return handle_invalid_guest_state(vcpu); -@@ -7630,7 +7632,6 @@ static void __noclone vmx_vcpu_run(struc - vmx->loaded_vmcs->launched = 1; - - vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); -- trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX); - - /* - * the KVM_REQ_EVENT optimization bit is only on for one entry, and if ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -6211,6 +6211,7 @@ static int vcpu_enter_guest(struct kvm_v - if (req_immediate_exit) - smp_send_reschedule(vcpu->cpu); - -+ trace_kvm_entry(vcpu->vcpu_id); - kvm_guest_enter(); - - if (unlikely(vcpu->arch.switch_db_regs)) { -@@ -6222,7 +6223,6 @@ static int vcpu_enter_guest(struct kvm_v - set_debugreg(vcpu->arch.dr6, 6); - } - -- trace_kvm_entry(vcpu->vcpu_id); - kvm_x86_ops->run(vcpu); - - /* diff --git a/queue-3.16/kvm-x86-svm-make-sure-nmi-is-injected-after-nmi_singlestep.patch b/queue-3.16/kvm-x86-svm-make-sure-nmi-is-injected-after-nmi_singlestep.patch deleted file mode 100644 index 08614bec..00000000 --- a/queue-3.16/kvm-x86-svm-make-sure-nmi-is-injected-after-nmi_singlestep.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: Vitaly Kuznetsov <vkuznets@redhat.com> -Date: Wed, 3 Apr 2019 16:06:42 +0200 -Subject: KVM: x86: svm: make sure NMI is injected after nmi_singlestep - -commit 99c221796a810055974b54c02e8f53297e48d146 upstream. - -I noticed that apic test from kvm-unit-tests always hangs on my EPYC 7401P, -the hanging test nmi-after-sti is trying to deliver 30000 NMIs and tracing -shows that we're sometimes able to deliver a few but never all. - -When we're trying to inject an NMI we may fail to do so immediately for -various reasons, however, we still need to inject it so enable_nmi_window() -arms nmi_singlestep mode. #DB occurs as expected, but we're not checking -for pending NMIs before entering the guest and unless there's a different -event to process, the NMI will never get delivered. - -Make KVM_REQ_EVENT request on the vCPU from db_interception() to make sure -pending NMIs are checked and possibly injected. - -Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -[bwh: Backported to 3.16: adjust context] -Signed-off-by: Ben Hutchings <ben@decadent.org.uk> ---- - arch/x86/kvm/svm.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -1783,6 +1783,7 @@ static int pf_interception(struct vcpu_s - static int db_interception(struct vcpu_svm *svm) - { - struct kvm_run *kvm_run = svm->vcpu.run; -+ struct kvm_vcpu *vcpu = &svm->vcpu; - - if (!(svm->vcpu.guest_debug & - (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) && -@@ -1796,6 +1797,8 @@ static int db_interception(struct vcpu_s - if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP)) - svm->vmcb->save.rflags &= - ~(X86_EFLAGS_TF | X86_EFLAGS_RF); -+ /* Make sure we check for pending NMIs upon entry */ -+ kvm_make_request(KVM_REQ_EVENT, vcpu); - } - - if (svm->vcpu.guest_debug & diff --git a/queue-3.16/series b/queue-3.16/series index baff785e..08546f5e 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -88,10 +88,6 @@ usb-core-fix-unterminated-string-returned-by-usb_string.patch staging-comedi-vmk80xx-fix-use-of-uninitialized-semaphore.patch staging-comedi-vmk80xx-fix-possible-double-free-of-usb_rx_buf.patch kvm-mmu-fix-overflow-on-kvm-mmu-page-limit-calculation.patch -kvm-x86-svm-make-sure-nmi-is-injected-after-nmi_singlestep.patch -kvm-x86-move-tracepoints-outside-extended-quiescent-state.patch -kvm-vmx-handle-vmlaunch-vmresume-failure-properly.patch -x86-kvm-move-kvm_load-put_guest_xcr0-into-atomic-context.patch tools-lib-traceevent-fix-missing-equality-check-for-strcmp.patch cifs-fix-handle-leak-in-smb2_query_symlink.patch cifs-keep-fileinfo-handle-live-during-oplock-break.patch diff --git a/queue-3.16/x86-kvm-move-kvm_load-put_guest_xcr0-into-atomic-context.patch b/queue-3.16/x86-kvm-move-kvm_load-put_guest_xcr0-into-atomic-context.patch deleted file mode 100644 index 39f91d6b..00000000 --- a/queue-3.16/x86-kvm-move-kvm_load-put_guest_xcr0-into-atomic-context.patch +++ /dev/null @@ -1,136 +0,0 @@ -From: WANG Chao <chao.wang@ucloud.cn> -Date: Fri, 12 Apr 2019 15:55:39 +0800 -Subject: x86/kvm: move kvm_load/put_guest_xcr0 into atomic context - -commit 1811d979c71621aafc7b879477202d286f7e863b upstream. - -guest xcr0 could leak into host when MCE happens in guest mode. Because -do_machine_check() could schedule out at a few places. - -For example: - -kvm_load_guest_xcr0 -... -kvm_x86_ops->run(vcpu) { - vmx_vcpu_run - vmx_complete_atomic_exit - kvm_machine_check - do_machine_check - do_memory_failure - memory_failure - lock_page - -In this case, host_xcr0 is 0x2ff, guest vcpu xcr0 is 0xff. After schedule -out, host cpu has guest xcr0 loaded (0xff). - -In __switch_to { - switch_fpu_finish - copy_kernel_to_fpregs - XRSTORS - -If any bit i in XSTATE_BV[i] == 1 and xcr0[i] == 0, XRSTORS will -generate #GP (In this case, bit 9). Then ex_handler_fprestore kicks in -and tries to reinitialize fpu by restoring init fpu state. Same story as -last #GP, except we get DOUBLE FAULT this time. - -Signed-off-by: WANG Chao <chao.wang@ucloud.cn> -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> -[bwh: Backported to 3.16: adjust filename] -Signed-off-by: Ben Hutchings <ben@decadent.org.uk> ---- ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -3971,6 +3971,7 @@ static void svm_vcpu_run(struct kvm_vcpu - svm->vmcb->save.cr2 = vcpu->arch.cr2; - - clgi(); -+ kvm_load_guest_xcr0(vcpu); - - /* - * If this vCPU has touched SPEC_CTRL, restore the guest's value if -@@ -4118,6 +4119,7 @@ static void svm_vcpu_run(struct kvm_vcpu - if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) - kvm_before_handle_nmi(&svm->vcpu); - -+ kvm_put_guest_xcr0(vcpu); - stgi(); - - /* Any pending NMI will happen here */ ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -7455,6 +7455,8 @@ static void __noclone vmx_vcpu_run(struc - if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) - vmx_set_interrupt_shadow(vcpu, 0); - -+ kvm_load_guest_xcr0(vcpu); -+ - atomic_switch_perf_msrs(vmx); - debugctlmsr = get_debugctlmsr(); - -@@ -7627,6 +7629,8 @@ static void __noclone vmx_vcpu_run(struc - | (1 << VCPU_EXREG_CR3)); - vcpu->arch.regs_dirty = 0; - -+ kvm_put_guest_xcr0(vcpu); -+ - /* - * the KVM_REQ_EVENT optimization bit is only on for one entry, and if - * we did not inject a still-pending event to L1 now because of ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -590,7 +590,7 @@ void kvm_lmsw(struct kvm_vcpu *vcpu, uns - } - EXPORT_SYMBOL_GPL(kvm_lmsw); - --static void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu) -+void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu) - { - if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) && - !vcpu->guest_xcr0_loaded) { -@@ -599,8 +599,9 @@ static void kvm_load_guest_xcr0(struct k - vcpu->guest_xcr0_loaded = 1; - } - } -+EXPORT_SYMBOL_GPL(kvm_load_guest_xcr0); - --static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu) -+void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu) - { - if (vcpu->guest_xcr0_loaded) { - if (vcpu->arch.xcr0 != host_xcr0) -@@ -608,6 +609,7 @@ static void kvm_put_guest_xcr0(struct kv - vcpu->guest_xcr0_loaded = 0; - } - } -+EXPORT_SYMBOL_GPL(kvm_put_guest_xcr0); - - int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) - { -@@ -6206,8 +6208,6 @@ static int vcpu_enter_guest(struct kvm_v - goto cancel_injection; - } - -- kvm_load_guest_xcr0(vcpu); -- - if (req_immediate_exit) - smp_send_reschedule(vcpu->cpu); - -@@ -6256,8 +6256,6 @@ static int vcpu_enter_guest(struct kvm_v - vcpu->mode = OUTSIDE_GUEST_MODE; - smp_wmb(); - -- kvm_put_guest_xcr0(vcpu); -- - /* Interrupt is enabled by handle_external_intr() */ - kvm_x86_ops->handle_external_intr(vcpu); - ---- a/arch/x86/kvm/x86.h -+++ b/arch/x86/kvm/x86.h -@@ -148,4 +148,7 @@ extern u64 kvm_supported_xcr0(void); - extern unsigned int min_timer_period_us; - - extern struct static_key kvm_no_apic_vcpu; -+ -+void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu); -+void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu); - #endif |