2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00
linux-next/arch/x86/kvm
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
..
mmu KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
vmx KVM: VMX: Add a trampoline to fix VMREAD error handling 2020-03-31 10:48:11 -04:00
cpuid.c KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
cpuid.h KVM: x86: Refactor kvm_cpuid() param that controls out-of-range logic 2020-03-16 17:58:50 +01:00
debugfs.c KVM: no need to check return value of debugfs_create functions 2019-08-05 12:55:49 +02:00
emulate.c KVM: x86: Refactor kvm_cpuid() param that controls out-of-range logic 2020-03-16 17:58:50 +01:00
hyperv.c KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
hyperv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
i8254.c KVM: x86: Fix print format and coding style 2020-03-16 17:57:08 +01: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: Lazy update IOAPIC EOI 2020-02-05 15:17:44 +01:00
ioapic.h KVM: X86: Move irrelevant declarations out of ioapic.h 2020-01-08 17:33:14 +01: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 320 2019-06-05 17:37:05 +02:00
irq.h KVM: X86: Move irrelevant declarations out of ioapic.h 2020-01-08 17:33:14 +01:00
Kconfig KVM: allow disabling -Werror 2020-02-28 10:45:28 +01:00
kvm_cache_regs.h KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
kvm_emulate.h KVM: x86: Refactor kvm_cpuid() param that controls out-of-range logic 2020-03-16 17:58:50 +01:00
lapic.c KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
lapic.h KVM: X86: Micro-optimize IPI fastpath delay 2020-03-26 05:58:26 -04:00
Makefile KVM: allow disabling -Werror 2020-02-28 10:45:28 +01:00
mmu_audit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
mmu.h KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
mmutrace.h KVM: x86: fix incorrect comparison in trace event 2020-02-20 18:13:44 +01: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_amd.c KVM: x86/vPMU: Add lazy mechanism to release perf_event per vPMC 2019-11-15 11:44:10 +01:00
pmu.c KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
pmu.h KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
svm.c KVM: SVM: Annotate svm_x86_ops as __initdata 2020-03-31 10:48:11 -04:00
trace.h KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -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: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00
x86.h KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection 2020-03-31 10:48:08 -04:00