[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220429094355.122389-37-chenzhongjin@huawei.com>
Date: Fri, 29 Apr 2022 17:43:54 +0800
From: Chen Zhongjin <chenzhongjin@...wei.com>
To: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-arch@...r.kernel.org>
CC: <jthierry@...hat.com>, <catalin.marinas@....com>,
<will@...nel.org>, <masahiroy@...nel.org>, <jpoimboe@...hat.com>,
<peterz@...radead.org>, <ycote@...hat.com>,
<herbert@...dor.apana.org.au>, <mark.rutland@....com>,
<davem@...emloft.net>, <ardb@...nel.org>, <maz@...nel.org>,
<tglx@...utronix.de>, <luc.vanoostenryck@...il.com>,
<chenzhongjin@...wei.com>
Subject: [RFC PATCH v4 36/37] arm64: entry: Align stack size for alternative
In kernel_exit there is a alternative branch for KPTI which causes
stack size conflict for two instruction boundaries.
To fix that, make both branch move the sp and then revert it in
tramp_exit branch.
Signed-off-by: Chen Zhongjin <chenzhongjin@...wei.com>
---
arch/arm64/kernel/entry.S | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index c7ab5143949f..fa3c5a2cd2c3 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -429,7 +429,11 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
ldr lr, [sp, #S_LR]
add sp, sp, #PT_REGS_SIZE // restore sp
eret
-alternative_else_nop_endif
+alternative_else
+ nop
+ add sp, sp, #PT_REGS_SIZE // restore sp
+ nop
+alternative_endif
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
bne 4f
msr far_el1, x29
@@ -726,6 +730,7 @@ alternative_else_nop_endif
.endm
.macro tramp_exit, regsize = 64
+ sub sp, sp, #PT_REGS_SIZE // revert sp
tramp_data_read_var x30, this_cpu_vector
get_this_cpu_offset x29
ldr x30, [x30, x29]
--
2.17.1
Powered by blists - more mailing lists