Skip to content

Commit 9d1869f

Browse files
leitaowilldeacon
authored andcommitted
arm64: remove CONFIG_VMAP_STACK checks from entry code
With VMAP_STACK now always enabled on arm64, remove all CONFIG_VMAP_STACK conditionals from entry handling in arch/arm64/kernel/entry-common.c and arch/arm64/kernel/entry.S. This change unconditionally includes the bad stack handling and overflow detection logic, simplifying the code and reflecting the mandatory use of VMAP_STACK for all arm64 kernel builds. Signed-off-by: Breno Leitao <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 3e72b9e commit 9d1869f

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

arch/arm64/kernel/entry-common.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,6 @@ UNHANDLED(el0t, 32, fiq)
977977
UNHANDLED(el0t, 32, error)
978978
#endif /* CONFIG_COMPAT */
979979

980-
#ifdef CONFIG_VMAP_STACK
981980
asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)
982981
{
983982
unsigned long esr = read_sysreg(esr_el1);
@@ -986,7 +985,6 @@ asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)
986985
arm64_enter_nmi(regs);
987986
panic_bad_stack(regs, esr, far);
988987
}
989-
#endif /* CONFIG_VMAP_STACK */
990988

991989
#ifdef CONFIG_ARM_SDE_INTERFACE
992990
asmlinkage noinstr unsigned long

arch/arm64/kernel/entry.S

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
.endif
5656

5757
sub sp, sp, #PT_REGS_SIZE
58-
#ifdef CONFIG_VMAP_STACK
5958
/*
6059
* Test whether the SP has overflowed, without corrupting a GPR.
6160
* Task and IRQ stacks are aligned so that SP & (1 << THREAD_SHIFT)
@@ -97,7 +96,6 @@
9796
/* We were already on the overflow stack. Restore sp/x0 and carry on. */
9897
sub sp, sp, x0
9998
mrs x0, tpidrro_el0
100-
#endif
10199
b el\el\ht\()_\regsize\()_\label
102100
.org .Lventry_start\@ + 128 // Did we overflow the ventry slot?
103101
.endm
@@ -540,7 +538,6 @@ SYM_CODE_START(vectors)
540538
kernel_ventry 0, t, 32, error // Error 32-bit EL0
541539
SYM_CODE_END(vectors)
542540

543-
#ifdef CONFIG_VMAP_STACK
544541
SYM_CODE_START_LOCAL(__bad_stack)
545542
/*
546543
* We detected an overflow in kernel_ventry, which switched to the
@@ -568,7 +565,6 @@ SYM_CODE_START_LOCAL(__bad_stack)
568565
bl handle_bad_stack
569566
ASM_BUG()
570567
SYM_CODE_END(__bad_stack)
571-
#endif /* CONFIG_VMAP_STACK */
572568

573569

574570
.macro entry_handler el:req, ht:req, regsize:req, label:req
@@ -1003,7 +999,6 @@ SYM_CODE_START(__sdei_asm_handler)
1003999
1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6
10041000
2: str x19, [x5]
10051001

1006-
#ifdef CONFIG_VMAP_STACK
10071002
/*
10081003
* entry.S may have been using sp as a scratch register, find whether
10091004
* this is a normal or critical event and switch to the appropriate
@@ -1016,7 +1011,6 @@ SYM_CODE_START(__sdei_asm_handler)
10161011
2: mov x6, #SDEI_STACK_SIZE
10171012
add x5, x5, x6
10181013
mov sp, x5
1019-
#endif
10201014

10211015
#ifdef CONFIG_SHADOW_CALL_STACK
10221016
/* Use a separate shadow call stack for normal and critical events */

0 commit comments

Comments
 (0)