From: Ard Biesheuvel <ardb@kernel.org>
To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk
Cc: arnd@arndb.de, linus.walleij@linaro.org,
Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH 3/6] ARM: spectre-bhb: simplify BPIALL vector macro
Date: Mon, 28 Mar 2022 15:47:11 +0200 [thread overview]
Message-ID: <20220328134714.205342-4-ardb@kernel.org> (raw)
In-Reply-To: <20220328134714.205342-1-ardb@kernel.org>
The BPIALL mitigation for Spectre-BHB adds a single instruction to the
handler sequence that doesn't clobber any registers. Given that these
sequences are 10 instructions long, they don't fit neatly into a
cacheline anyway, so we can simply move that single instruction to the
start of it, and rearrange the symbol names accordingly.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/arm/kernel/entry-armv.S | 21 ++++++--------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 4bbd92d41031..a5725e82addc 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -996,6 +996,12 @@ __kuser_helper_end:
*/
.macro vector_stub, name, mode, correction=0
.align 5
+#ifdef CONFIG_HARDEN_BRANCH_HISTORY
+vector_bhb_bpiall_\name:
+ mcr p15, 0, r0, c7, c5, 6 @ BPIALL
+ @ isb not needed due to "movs pc, lr" in the vector stub
+ @ which gives a "context synchronisation".
+#endif
vector_\name:
.if \correction
@@ -1047,21 +1053,6 @@ vector_bhb_loop8_\name:
isb
b 2b
ENDPROC(vector_bhb_loop8_\name)
-
-vector_bhb_bpiall_\name:
- .if \correction
- sub lr, lr, #\correction
- .endif
-
- @ Save r0, lr_<exception> (parent PC)
- stmia sp, {r0, lr}
-
- @ bhb workaround
- mcr p15, 0, r0, c7, c5, 6 @ BPIALL
- @ isb not needed due to "movs pc, lr" in the vector stub
- @ which gives a "context synchronisation".
- b 2b
-ENDPROC(vector_bhb_bpiall_\name)
.previous
#endif
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-03-28 13:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 13:47 [PATCH 0/6] ARM: spectre-bhb fixes and tweaks Ard Biesheuvel
2022-03-28 13:47 ` [PATCH 1/6] ARM: spectre-bhb: enable for Cortex-A15 Ard Biesheuvel
2022-05-24 14:50 ` Jon Hunter
2022-05-24 14:50 ` Jon Hunter
2022-05-24 15:21 ` Ard Biesheuvel
2022-05-24 15:21 ` Ard Biesheuvel
2022-05-24 16:06 ` Jon Hunter
2022-05-24 16:06 ` Jon Hunter
2022-05-24 17:03 ` Russell King (Oracle)
2022-05-24 17:03 ` Russell King (Oracle)
2022-05-24 17:49 ` Jon Hunter
2022-05-24 17:49 ` Jon Hunter
2022-05-25 7:09 ` Ard Biesheuvel
2022-05-25 7:09 ` Ard Biesheuvel
2022-05-25 10:48 ` Jon Hunter
2022-05-25 10:48 ` Jon Hunter
2022-05-25 10:52 ` Ard Biesheuvel
2022-05-25 10:52 ` Ard Biesheuvel
2022-06-07 14:30 ` Jon Hunter
2022-06-07 14:30 ` Jon Hunter
2022-06-07 14:32 ` Ard Biesheuvel
2022-06-07 14:32 ` Ard Biesheuvel
2022-06-07 14:35 ` Jon Hunter
2022-06-07 14:35 ` Jon Hunter
2022-06-07 14:39 ` Ard Biesheuvel
2022-06-07 14:39 ` Ard Biesheuvel
2022-03-28 13:47 ` [PATCH 2/6] ARM: spectre-bhb: fix loop8 sequence for Thumb2 Ard Biesheuvel
2022-03-28 13:47 ` Ard Biesheuvel [this message]
2022-03-28 13:47 ` [PATCH 4/6] ARM: spectre-bhb: use local DSB and elide ISB in loop8 sequence Ard Biesheuvel
2022-03-28 13:47 ` [PATCH 5/6] ARM: spectre-bhb: avoid cross-subsection jump using a numbered label Ard Biesheuvel
2022-03-31 14:07 ` Russell King (Oracle)
2022-03-31 16:22 ` Ard Biesheuvel
2022-03-28 13:47 ` [PATCH 6/6] ARM: spectre-bhb: rely on linker to emit cross-section literal loads Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220328134714.205342-4-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.