linux_dsm_epyc7002/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
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
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
vgic-sys-reg-v3.c