linux-stable/arch
Liran Alon e51bfdb687 KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU
Issue was discovered when running kvm-unit-tests on KVM running as L1 on
top of Hyper-V.

When vmx_instruction_intercept unit-test attempts to run RDPMC to test
RDPMC-exiting, it is intercepted by L1 KVM which it's EXIT_REASON_RDPMC
handler raise #GP because vCPU exposed by Hyper-V doesn't support PMU.
Instead of unit-test expectation to be reflected with EXIT_REASON_RDPMC.

The reason vmx_instruction_intercept unit-test attempts to run RDPMC
even though Hyper-V doesn't support PMU is because L1 expose to L2
support for RDPMC-exiting. Which is reasonable to assume that is
supported only in case CPU supports PMU to being with.

Above issue can easily be simulated by modifying
vmx_instruction_intercept config in x86/unittests.cfg to run QEMU with
"-cpu host,+vmx,-pmu" and run unit-test.

To handle issue, change KVM to expose RDPMC-exiting only when guest
supports PMU.

Reported-by: Saar Amar <saaramar@microsoft.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-04-16 15:37:34 +02:00
..
alpha KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
arc syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
arm ARM: SoC fixes 2019-04-07 13:46:17 -10:00
arm64 ARM: SoC fixes 2019-04-07 13:46:17 -10:00
c6x syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
csky syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
h8300 syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
hexagon syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
ia64 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
m68k KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
microblaze syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
mips A few minor MIPS fixes: 2019-04-09 16:27:18 -10:00
nds32 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
nios2 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
openrisc syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
parisc parisc: Detect QEMU earlier in boot process 2019-04-06 19:07:55 +02:00
powerpc Merge branch 'akpm' (patches from Andrew) 2019-04-05 17:08:55 -10:00
riscv Andy Lutomirski approached me to tell me that the syscall_get_arguments() 2019-04-05 13:15:57 -10:00
s390 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
sh Merge branch 'akpm' (patches from Andrew) 2019-04-05 17:08:55 -10:00
sparc syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
um syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
unicore32 KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
x86 KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU 2019-04-16 15:37:34 +02:00
xtensa xtensa fixes for v5.1-rc5 2019-04-08 17:04:42 -10:00
.gitignore
Kconfig Char/Misc driver patches for 5.1-rc1 2019-03-06 14:18:59 -08:00