From: Ard Biesheuvel Date: Wed, 20 Apr 2022 08:46:17 +0000 (+0100) Subject: ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a7e49f1a81007228dbb2ddc5e50a0d4f5b42fea8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2 [ Upstream commit 3cfb3019979666bdf33a1010147363cf05e0f17b ] In Thumb2, 'b . + 4' produces a branch instruction that uses a narrow encoding, and so it does not jump to the following instruction as expected. So use W(b) instead. Fixes: 6c7cb60bff7a ("ARM: fix Thumb2 regression with Spectre BHB") Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index b54084f9b77a..e1b3c5c96560 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -1071,7 +1071,7 @@ vector_bhb_loop8_\name: @ bhb workaround mov r0, #8 -3: b . + 4 +3: W(b) . + 4 subs r0, r0, #1 bne 3b dsb