linux-brain/arch/x86
Sean Christopherson 032fd28ed5 KVM: nVMX: Ensure 64-bit shift when checking VMFUNC bitmap
[ Upstream commit 0e75225dfa4c5d5d51291f54a3d2d5895bad38da ]

Use BIT_ULL() instead of an open-coded shift to check whether or not a
function is enabled in L1's VMFUNC bitmap.  This is a benign bug as KVM
supports only bit 0, and will fail VM-Enter if any other bits are set,
i.e. bits 63:32 are guaranteed to be zero.

Note, "function" is bounded by hardware as VMFUNC will #UD before taking
a VM-Exit if the function is greater than 63.

Before:
  if ((vmcs12->vm_function_control & (1 << function)) == 0)
   0x000000000001a916 <+118>:	mov    $0x1,%eax
   0x000000000001a91b <+123>:	shl    %cl,%eax
   0x000000000001a91d <+125>:	cltq
   0x000000000001a91f <+127>:	and    0x128(%rbx),%rax

After:
  if (!(vmcs12->vm_function_control & BIT_ULL(function & 63)))
   0x000000000001a955 <+117>:	mov    0x128(%rbx),%rdx
   0x000000000001a95c <+124>:	bt     %rax,%rdx

Fixes: 27c42a1bb8 ("KVM: nVMX: Enable VMFUNC for the L1 hypervisor")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210609234235.1244004-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14 16:53:23 +02:00
..
boot x86/boot: Add .text.* to setup.ld 2021-06-16 11:59:38 +02:00
configs vgacon: remove software scrollback support 2020-09-17 13:47:54 +02:00
crypto crypto: x86/aes-ni-xts - use direct calls to and 4-way stride 2021-03-20 10:39:47 +01:00
entry x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
events x86/events/amd/iommu: Fix sysfs type mismatch 2021-05-14 09:44:26 +02:00
hyperv x86/hyperv: check cpu mask after interrupt has been disabled 2021-01-19 18:26:12 +01:00
ia32 syscalls/x86: Use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn 2020-01-17 19:48:30 +01:00
include x86/pkru: Write hardware init value to PKRU when xstate is init 2021-06-23 14:41:29 +02:00
kernel x86/fpu: Reset state for all signal restore failures 2021-06-23 14:41:29 +02:00
kvm KVM: nVMX: Ensure 64-bit shift when checking VMFUNC bitmap 2021-07-14 16:53:23 +02:00
lib x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes 2021-05-22 11:38:27 +02:00
math-emu x86: math-emu: Fix up 'cmp' insn for clang ias 2020-07-29 10:18:40 +02:00
mm x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc() 2021-03-30 14:35:29 +02:00
net bpf, x86: Validate computation of branch displacements for x86-32 2021-04-10 13:34:31 +02:00
oprofile
pci PCI: Add AMD RS690 quirk to enable 64-bit DMA 2021-06-30 08:47:49 -04:00
platform efi/x86: Free efi_pgd with free_pages() 2020-11-24 13:29:19 +01:00
power x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
purgatory x86/purgatory: Disable various profiling and sanitizing options 2020-06-24 17:50:20 +02:00
ras RAS/CEC: Add CONFIG_RAS_CEC_DEBUG and move CEC debug features there 2019-06-08 17:39:24 +02:00
realmode x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
tools x86/build: Treat R_386_PLT32 relocation as R_386_PC32 2021-03-07 12:20:45 +01:00
um um: Implement copy_thread_tls 2020-01-14 20:08:35 +01:00
video treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
xen Xen/gnttab: handle p2m update errors on a per-slot basis 2021-03-07 12:20:49 +01:00
.gitignore
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
Kconfig x86/platform/uv: Fix !KEXEC build failure 2021-05-14 09:44:22 +02:00
Kconfig.cpu x86/cpu: Create Zhaoxin processors architecture support file 2019-06-22 11:45:57 +02:00
Kconfig.debug x86, perf: Fix the dependency of the x86 insn decoder selftest 2019-09-02 20:05:58 +02:00
Makefile x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) 2021-05-11 14:04:06 +02:00
Makefile.um x86, powerpc: Remove -funit-at-a-time compiler option entirely 2018-12-09 11:55:32 +01:00
Makefile_32.cpu