2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00
linux-next/arch/x86/kvm/vmx
Sean Christopherson 842f4be958 KVM: VMX: Add a trampoline to fix VMREAD error handling
Add a hand coded assembly trampoline to preserve volatile registers
across vmread_error(), and to handle the calling convention differences
between 64-bit and 32-bit due to asmlinkage on vmread_error().  Pass
@field and @fault on the stack when invoking the trampoline to avoid
clobbering volatile registers in the context of the inline assembly.

Calling vmread_error() directly from inline assembly is partially broken
on 64-bit, and completely broken on 32-bit.  On 64-bit, it will clobber
%rdi and %rsi (used to pass @field and @fault) and any volatile regs
written by vmread_error().  On 32-bit, asmlinkage means vmread_error()
expects the parameters to be passed on the stack, not via regs.

Opportunistically zero out the result in the trampoline to save a few
bytes of code for every VMREAD.  A happy side effect of the trampoline
is that the inline code footprint is reduced by three bytes on 64-bit
due to PUSH/POP being more efficent (in terms of opcode bytes) than MOV.

Fixes: 6e2020977e ("KVM: VMX: Add error handling to VMREAD helper")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200326160712.28803-1-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-31 10:48:11 -04:00
..
capabilities.h KVM: x86: Handle PKU CPUID adjustment in VMX code 2020-03-16 17:58:19 +01:00
evmcs.c x86/kvm/hyper-v: don't allow to turn on unsupported VMX controls for nested guests 2020-02-05 15:55:26 +01:00
evmcs.h KVM: nVMX: properly handle errors in nested_vmx_handle_enlightened_vmptrld() 2020-03-16 18:19:30 +01:00
nested.c KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
nested.h KVM: VMX: Configure runtime hooks using vmx_x86_ops 2020-03-31 10:48:06 -04:00
ops.h KVM: VMX: Add a trampoline to fix VMREAD error handling 2020-03-31 10:48:11 -04:00
pmu_intel.c KVM: VMX: Directly query Intel PT mode when refreshing PMUs 2020-03-16 17:58:38 +01:00
vmcs12.c
vmcs12.h KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
vmcs_shadow_fields.h KVM: Fix some out-dated function names in comment 2020-01-21 13:57:27 +01:00
vmcs.h KVM: VMX: Leave preemption timer running when it's disabled 2019-06-18 17:10:46 +02:00
vmenter.S KVM: VMX: Add a trampoline to fix VMREAD error handling 2020-03-31 10:48:11 -04:00
vmx.c KVM: VMX: Annotate vmx_x86_ops as __initdata 2020-03-31 10:48:10 -04:00
vmx.h KVM: VMX: Fold loaded_vmcs_init() into alloc_loaded_vmcs() 2020-03-23 15:44:26 -04:00