linux-stable/arch/arm64
D Scott Phillips b09b539c15 arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro
[ Upstream commit 8ec8490a19 ]

CONFIG_UBSAN_SHIFT with gcc-5 complains that the shifting of
ARM_CPU_IMP_AMPERE (0xC0) into bits [31:24] by MIDR_CPU_MODEL() is
undefined behavior. Well, sort of, it actually spells the error as:

 arch/arm64/kernel/proton-pack.c: In function 'spectre_bhb_loop_affected':
 arch/arm64/include/asm/cputype.h:44:2: error: initializer element is not constant
   (((imp)   << MIDR_IMPLEMENTOR_SHIFT) | \
   ^

This isn't an issue for other Implementor codes, as all the other codes
have zero in the top bit and so are representable as a signed int.

Cast the implementor code to unsigned in MIDR_CPU_MODEL to remove the
undefined behavior.

Fixes: 0e5d5ae837 ("arm64: Add AMPERE1 to the Spectre-BHB affected list")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
Link: https://lore.kernel.org/r/20221102160106.1096948-1-scott@os.amperecomputing.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-26 09:27:30 +01:00
..
boot arm64: dts: qcom: sm8250: Disable the not yet supported cluster idle state 2022-11-26 09:27:26 +01:00
configs arm64: defconfig: enable ARCH_NXP 2022-09-12 18:15:49 +08:00
crypto crypto: arm64/poly1305 - fix a read out-of-bound 2022-07-29 18:29:17 +08:00
hyperv
include arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro 2022-11-26 09:27:30 +01:00
kernel arm64: efi: Fix handling of misaligned runtime regions and drop warning 2022-11-16 10:04:04 +01:00
kvm KVM: arm64: Fix SMPRI_EL1/TPIDR2_EL0 trapping on VHE 2022-11-10 18:17:38 +01:00
lib Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
mm arm64: fix rodata=full again 2022-11-26 09:27:22 +01:00
net bpf, arm64: Fix bpf trampoline instruction endianness 2022-08-10 16:50:57 +02:00
tools arm64: errata: add detection for AMEVCNTR01 incrementing incorrectly 2022-08-23 11:06:48 +01:00
xen
Kbuild
Kconfig arm64: errata: Add Cortex-A55 to the repeat tlbi list 2022-10-21 12:37:42 +02:00
Kconfig.debug
Kconfig.platforms ARM: new SoC support for 6.0 2022-08-02 08:29:18 -07:00
Makefile kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00