1
0
Fork 0
alistair23-linux/arch/arm64
Will Deacon 1767f1ec12 KVM: arm64: Ensure 'params' is initialised when looking up sys register
commit 1ce74e96c2 upstream.

Commit 4b927b94d5 ("KVM: arm/arm64: vgic: Introduce find_reg_by_id()")
introduced 'find_reg_by_id()', which looks up a system register only if
the 'id' index parameter identifies a valid system register. As part of
the patch, existing callers of 'find_reg()' were ported over to the new
interface, but this breaks 'index_to_sys_reg_desc()' in the case that the
initial lookup in the vCPU target table fails because we will then call
into 'find_reg()' for the system register table with an uninitialised
'param' as the key to the lookup.

GCC 10 is bright enough to spot this (amongst a tonne of false positives,
but hey!):

  | arch/arm64/kvm/sys_regs.c: In function ‘index_to_sys_reg_desc.part.0.isra’:
  | arch/arm64/kvm/sys_regs.c:983:33: warning: ‘params.Op2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  |   983 |   (u32)(x)->CRn, (u32)(x)->CRm, (u32)(x)->Op2);
  | [...]

Revert the hunk of 4b927b94d5 which breaks 'index_to_sys_reg_desc()' so
that the old behaviour of checking the index upfront is restored.

Fixes: 4b927b94d5 ("KVM: arm/arm64: vgic: Introduce find_reg_by_id()")
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191212094049.12437-1-will@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-31 16:46:24 +01:00
..
boot arm64: dts: exynos: Revert "Remove unneeded address space mapping for soc node" 2019-12-13 08:42:57 +01:00
configs arm64/ARM: configs: Change CONFIG_REMOTEPROC from m to y 2019-09-30 11:48:00 -07:00
crypto crypto: arm64/aes-neonbs - implement ciphertext stealing for XTS 2019-09-09 17:35:39 +10:00
include arm64: Validate tagged addresses in access_ok() called from kernel threads 2019-12-13 08:42:56 +01:00
kernel arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill() 2019-12-31 16:44:21 +01:00
kvm KVM: arm64: Ensure 'params' is initialised when looking up sys register 2019-12-31 16:46:24 +01:00
lib arm64: uaccess: Remove uaccess_*_not_uao asm macros 2019-11-20 18:51:54 +00:00
mm arm64: mm: fix inverted PAR_EL1.F check 2019-10-16 09:58:03 -07:00
net arm64: bpf: optimize modulo operation 2019-09-03 15:44:40 +02:00
xen xen/efi: have a common runtime setup function 2019-10-02 10:31:07 -04:00
Kbuild arm64: add arch/arm64/Kbuild 2019-08-21 18:47:15 +01:00
Kconfig Merge branch 'errata/tx2-219' into for-next/fixes 2019-10-17 13:42:42 -07:00
Kconfig.debug treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.platforms arm64: exynos: Enable exynos-chipid driver 2019-09-04 22:43:26 +02:00
Makefile arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option 2019-10-07 13:32:15 +01:00