1
0
Fork 0
alistair23-linux/arch/x86/kvm
Sean Christopherson 489cbcf01d KVM: x86: Add WARNs to detect out-of-bounds register indices
Add WARN_ON_ONCE() checks in kvm_register_{read,write}() to detect reg
values that would cause KVM to overflow vcpu->arch.regs.  Change the reg
param to an 'int' to make it clear that the reg index is unverified.

Regarding the overhead of WARN_ON_ONCE(), now that all fixed GPR reads
and writes use dedicated accessors, e.g. kvm_rax_read(), the overhead
is limited to flows where the reg index is generated at runtime.  And
there is at least one historical bug where KVM has generated an out-of-
bounds access to arch.regs (see commit b68f3cc7d9, "KVM: x86: Always
use 32-bit SMRAM save state for 32-bit kernels").

Adding the WARN_ON_ONCE() protection paves the way for additional
cleanup related to kvm_reg and kvm_reg_ex.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-22 13:34:13 +02:00
..
vmx KVM: VMX: Optimize vmx_set_rflags() for unrestricted guest 2019-10-22 13:34:12 +02:00
Kconfig kvm: x86: add host poll control msrs 2019-06-18 11:43:46 +02:00
Makefile KVM: x86: fix TRACE_INCLUDE_PATH and remove -I. header search paths 2019-01-25 19:12:37 +01:00
cpuid.c kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID 2019-10-22 13:31:12 +02:00
cpuid.h x86/cpufeatures: Combine word 11 and 12 into a new scattered features word 2019-06-20 12:38:44 +02: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: set ctxt->have_exception in x86_decode_insn() 2019-09-11 18:01:34 +02:00
hyperv.c KVM: x86: hyper-v: set NoNonArchitecturalCoreSharing CPUID bit when SMT is impossible 2019-09-24 13:37:30 +02:00
hyperv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
i8254.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +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: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
ioapic.c kvm: x86: ioapic and apic debug macros cleanup 2019-07-15 20:39:01 +02:00
ioapic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 320 2019-06-05 17:37:05 +02:00
irq.h KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
irq_comm.c KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
kvm_cache_regs.h KVM: x86: Add WARNs to detect out-of-bounds register indices 2019-10-22 13:34:13 +02:00
lapic.c KVM: LAPIC: Loosen filter for adaptive tuning of lapic_timer_advance_ns 2019-09-26 12:31:29 +02:00
lapic.h KVM: LAPIC: Tune lapic_timer_advance_ns smoothly 2019-09-24 14:35:06 +02:00
mmu.c KVM: x86: fix nested guest live migration with PML 2019-09-27 13:13:39 +02:00
mmu.h KVM: x86/mmu: Add explicit access mask for MMIO SPTEs 2019-08-22 10:09:24 +02:00
mmu_audit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
mmutrace.h KVM: x86/mmu: Explicitly track only a single invalid mmu generation 2019-09-24 14:36:00 +02:00
mtrr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
page_track.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
paging_tmpl.h KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
pmu.c KVM: x86: Add fixed counters to PMU filter 2019-07-20 09:00:48 +02:00
pmu.h KVM: x86: PMU Event Filter 2019-07-11 15:08:28 +02:00
pmu_amd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
svm.c KVM: SVM: Reduce WBINVD/DF_FLUSH invocations 2019-10-22 13:34:09 +02:00
trace.h KVM: nVMX: trace nested VM-Enter failures detected by H/W 2019-09-11 17:34:17 +02: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: clear kvmclock MSR on reset 2019-10-22 13:31:22 +02:00
x86.h KVM: x86: Add WARNs to detect out-of-bounds register indices 2019-10-22 13:34:13 +02:00