Skip to content

Commit c4f486f

Browse files
ardbiesheuvelRussell King (Oracle)
authored andcommitted
ARM: 9198/1: spectre-bhb: simplify BPIALL vector macro
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 the unmitigated one, and rearrange the symbol names accordingly. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent 5080746 commit c4f486f

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

arch/arm/kernel/entry-armv.S

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,12 @@ __kuser_helper_end:
10781078
*/
10791079
.macro vector_stub, name, mode, correction=0
10801080
.align 5
1081+
#ifdef CONFIG_HARDEN_BRANCH_HISTORY
1082+
vector_bhb_bpiall_\name:
1083+
mcr p15, 0, r0, c7, c5, 6 @ BPIALL
1084+
@ isb not needed due to "movs pc, lr" in the vector stub
1085+
@ which gives a "context synchronisation".
1086+
#endif
10811087

10821088
vector_\name:
10831089
.if \correction
@@ -1129,21 +1135,6 @@ vector_bhb_loop8_\name:
11291135
isb
11301136
b 2b
11311137
ENDPROC(vector_bhb_loop8_\name)
1132-
1133-
vector_bhb_bpiall_\name:
1134-
.if \correction
1135-
sub lr, lr, #\correction
1136-
.endif
1137-
1138-
@ Save r0, lr_<exception> (parent PC)
1139-
stmia sp, {r0, lr}
1140-
1141-
@ bhb workaround
1142-
mcr p15, 0, r0, c7, c5, 6 @ BPIALL
1143-
@ isb not needed due to "movs pc, lr" in the vector stub
1144-
@ which gives a "context synchronisation".
1145-
b 2b
1146-
ENDPROC(vector_bhb_bpiall_\name)
11471138
.previous
11481139
#endif
11491140

0 commit comments

Comments
 (0)