kernel_optimize_test/arch/arm64/kvm
Dave Martin 55ffad3b63 KVM: arm64/sve: WARN when avoiding divide-by-zero in sve_reg_to_region()
sve_reg_to_region() currently passes the result of
vcpu_sve_state_size() to array_index_nospec(), effectively
leading to a divide / modulo operation.

Currently the code bails out and returns -EINVAL if
vcpu_sve_state_size() turns out to be zero, in order to avoid going
ahead and attempting to divide by zero.  This is reasonable, but it
should only happen if the kernel contains some other bug that
allowed this code to be reached without the vcpu having been
properly initialised.

To make it clear that this is a defence against bugs rather than
something that the user should be able to trigger, this patch marks
the check with WARN_ON().

Suggested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2019-04-18 17:14:01 +01:00
..
hyp KVM: arm64/sve: Context switch the SVE registers 2019-03-29 14:41:53 +00:00
debug.c arm/arm64: KVM: Introduce kvm_call_hyp_ret() 2019-02-19 21:05:24 +00:00
fpsimd.c KVM: arm64/sve: Context switch the SVE registers 2019-03-29 14:41:53 +00:00
guest.c KVM: arm64/sve: WARN when avoiding divide-by-zero in sve_reg_to_region() 2019-04-18 17:14:01 +01:00
handle_exit.c * ARM: selftests improvements, large PUD support for HugeTLB, 2018-12-26 11:46:28 -08:00
hyp-init.S arm64: KVM: Enable Common Not Private translations 2018-09-18 12:03:34 +01:00
hyp.S arm64: KVM: Drop VHE-specific HYP call stub 2019-02-19 21:05:28 +00:00
inject_fault.c arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS 2018-07-21 16:02:30 +01:00
irq.h
Kconfig treewide: surround Kconfig file paths with double quotes 2018-12-22 00:25:54 +09:00
Makefile KVM: arm/arm64: Prefix header search paths with $(srctree)/ 2019-02-19 21:05:53 +00:00
regmap.c kvm/arm: use PSR_AA32 definitions 2018-07-05 17:24:15 +01:00
reset.c KVM: arm/arm64: Demote kvm_arm_init_arch_resources() to just set up SVE 2019-04-18 17:14:01 +01:00
sys_regs_generic_v8.c
sys_regs.c KVM: arm64/sve: sys_regs: Demote redundant vcpu_has_sve() checks to WARNs 2019-04-18 17:14:01 +01:00
sys_regs.h KVM: arm64: Support runtime sysreg visibility filtering 2019-03-29 14:41:53 +00:00
trace.h arm64: KVM: Add trapped system register access tracepoint 2018-12-19 17:47:08 +00:00
va_layout.c arm64: KVM: Allow mapping of vectors outside of the RAM region 2018-03-19 13:06:46 +00:00
vgic-sys-reg-v3.c