linux/arch/x86/kvm/vmx
Sean Christopherson c8e2fe13d1 x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case
Initialize x86_pmu.guest_get_msrs to return 0/NULL to handle the "nop"
case.  Patching in perf_guest_get_msrs_nop() during setup does not work
if there is no PMU, as setup bails before updating the static calls,
leaving x86_pmu.guest_get_msrs NULL and thus a complete nop.  Ultimately,
this causes VMX abort on VM-Exit due to KVM putting random garbage from
the stack into the MSR load list.

Add a comment in KVM to note that nr_msrs is valid if and only if the
return value is non-NULL.

Fixes: abd562df94 ("x86/perf: Use static_call for x86_pmu.guest_get_msrs")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: syzbot+cce9ef2dd25246f815ee@syzkaller.appspotmail.com
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210309171019.1125243-1-seanjc@google.com
2021-03-10 16:45:09 +01:00
..
capabilities.h KVM: vmx/pmu: Expose LBR_FMT in the MSR_IA32_PERF_CAPABILITIES 2021-02-04 05:27:26 -05:00
evmcs.c KVM: x86: hyper-v: allow KVM_GET_SUPPORTED_HV_CPUID as a system ioctl 2020-11-15 09:49:11 -05:00
evmcs.h KVM: VMX: eVMCS: make evmcs_sanitize_exec_ctrls() work again 2020-10-31 10:27:58 -04:00
nested.c KVM: VMX: Dynamically enable/disable PML based on memslot dirty logging 2021-02-19 03:08:34 -05:00
nested.h KVM: nVMX: check for required but missing VMCS12 in KVM_SET_NESTED_STATE 2020-07-27 09:04:49 -04:00
pmu_intel.c KVM: vmx/pmu: Fix dummy check if lbr_desc->event is created 2021-02-23 12:07:35 -05:00
posted_intr.c KVM: VMX: Use x2apic_mode to avoid RDMSR when querying PI state 2021-02-04 05:27:22 -05:00
posted_intr.h KVM: vmx: rename pi_init to avoid conflict with paride 2020-10-24 04:09:54 -04:00
vmcs.h KVM: VMX: Add a helper to test for a valid error code given an intr info 2020-09-28 07:57:50 -04:00
vmcs12.c KVM: nVMX: Remove non-functional "support" for CR3 target values 2020-04-21 09:13:09 -04:00
vmcs12.h KVM: nVMX: Remove non-functional "support" for CR3 target values 2020-04-21 09:13:09 -04:00
vmcs_shadow_fields.h KVM: Fix some out-dated function names in comment 2020-01-21 13:57:27 +01:00
vmenter.S KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw 2021-02-04 05:27:32 -05:00
vmx.c x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case 2021-03-10 16:45:09 +01:00
vmx.h KVM: VMX: Dynamically enable/disable PML based on memslot dirty logging 2021-02-19 03:08:34 -05:00
vmx_ops.h KVM: VMX: Rename ops.h to vmx_ops.h 2020-09-28 07:57:38 -04:00