linux/arch/x86/kvm
Maxim Levitsky 9883764ad0 SVM: nSVM: correctly restore GIF on vmexit from nesting after migration
Currently code in svm_set_nested_state copies the current vmcb control
area to L1 control area (hsave->control), under assumption that
it mostly reflects the defaults that kvm choose, and later qemu
overrides  these defaults with L2 state using standard KVM interfaces,
like KVM_SET_REGS.

However nested GIF (which is AMD specific thing) is by default is true,
and it is copied to hsave area as such.

This alone is not a big deal since on VMexit, GIF is always set to false,
regardless of what it was on VM entry.  However in nested_svm_vmexit we
were first were setting GIF to false, but then we overwrite the control
fields with value from the hsave area.  (including the nested GIF field
itself if GIF virtualization is enabled).

Now on normal vm entry this is not a problem, since GIF is usually false
prior to normal vm entry, and this is the value that copied to hsave,
and then restored, but this is not always the case when the nested state
is loaded as explained above.

To fix this issue, move svm_set_gif after we restore the L1 control
state in nested_svm_vmexit, so that even with wrong GIF in the
saved L1 control area, we still clear GIF as the spec says.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20200827162720.278690-2-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-12 12:19:06 -04:00
..
mmu kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed 2020-09-11 13:16:55 -04:00
svm SVM: nSVM: correctly restore GIF on vmexit from nesting after migration 2020-09-12 12:19:06 -04:00
vmx KVM: VMX: Don't freeze guest when event delivery causes an APIC-access exit 2020-09-12 02:21:17 -04:00
cpuid.c x86: Expose SERIALIZE for supported cpuid 2020-08-09 13:08:54 -04:00
cpuid.h KVM: x86: Extract kvm_update_cpuid_runtime() from kvm_update_cpuid() 2020-07-09 06:53:49 -04:00
debugfs.c KVM: let kvm_destroy_vm_debugfs clean up vCPU debugfs directories 2020-06-04 11:00:54 -04:00
emulate.c KVM: x86: emulate reserved nops from 0f/18 to 0f/1f 2020-06-05 11:16:15 -04:00
hyperv.c x86/kvm/hyper-v: Synic default SCONTROL MSR needs to be enabled 2020-08-10 13:22:10 -04:00
hyperv.h x86/kvm/hyper-v: Add support for synthetic debugger interface 2020-06-01 04:26:11 -04:00
i8254.c kvm: i8254: remove redundant assignment to pointer s 2020-06-11 12:35:18 -04:00
i8254.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i8259.c KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks 2020-01-27 19:59:37 +01:00
ioapic.c kvm: ioapic: Restrict lazy EOI update to edge-triggered interrupts 2020-05-04 12:29:05 -04:00
ioapic.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
irq_comm.c KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI 2020-02-21 18:04:57 +01:00
irq.c KVM: nSVM: extract svm_set_gif 2020-06-01 04:26:01 -04:00
irq.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
Kconfig x86/kvm: Use generic xfer to guest work function 2020-07-24 15:05:01 +02:00
kvm_cache_regs.h KVM: x86: Mark CR4.TSD as being possibly owned by the guest 2020-07-03 12:16:28 -04:00
kvm_emulate.h ARM: 2020-04-02 15:13:15 -07:00
lapic.c s390: implement diag318 2020-08-06 12:59:31 -07:00
lapic.h KVM: x86: introduce kvm_can_use_hv_timer 2020-05-15 12:26:21 -04:00
Makefile kvm: Disable objtool frame pointer checking for vmenter.S 2020-04-20 17:11:19 -04:00
mmu.h KVM: x86: Pull the PGD's level from the MMU instead of recalculating it 2020-07-30 18:16:47 -04:00
mtrr.c KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks 2020-01-27 19:59:39 +01:00
pmu.c KVM/x86: pmu: Fix #GP condition check for RDPMC emulation 2020-07-09 07:08:37 -04:00
pmu.h kvm: x86: limit the maximum number of vPMU fixed counters to 3 2020-07-08 16:21:59 -04:00
trace.h x86/kvm/hyper-v: Add support for synthetic debugger interface 2020-06-01 04:26:11 -04:00
tss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
x86.c KVM: x86: always allow writing '0' to MSR_KVM_ASYNC_PF_EN 2020-09-11 13:26:47 -04:00
x86.h KVM: x86: Add helper functions for illegal GPA checking and page fault injection 2020-07-10 13:07:28 -04:00