Commit 9a964285 authored by Will Deacon's avatar Will Deacon

arm64: vdso: Don't prefix sigreturn trampoline with a BTI C instruction

For better or worse, GDB relies on the exact instruction sequence in the
VDSO sigreturn trampoline in order to unwind from signals correctly.
Commit c91db232 ("arm64: vdso: Convert to modern assembler annotations")
unfortunately added a BTI C instruction to the start of __kernel_rt_sigreturn,
which breaks this check. Thankfully, it's also not required, since the
trampoline is called from a RET instruction when returning from the signal
handler

Remove the unnecessary BTI C instruction from __kernel_rt_sigreturn,
and do the same for the 32-bit VDSO as well for good measure.

Cc: Daniel Kiss <daniel.kiss@arm.com>
Cc: Tamas Zsoldos <tamas.zsoldos@arm.com>
Reviewed-by: default avatarDave Martin <dave.martin@arm.com>
Reviewed-by: default avatarMark Brown <broonie@kernel.org>
Fixes: c91db232 ("arm64: vdso: Convert to modern assembler annotations")
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent e4e9f6df
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#define BTI_J hint 36 ; #define BTI_J hint 36 ;
/* /*
* When using in-kernel BTI we need to ensure that assembly functions * When using in-kernel BTI we need to ensure that PCS-conformant assembly
* have suitable annotations. Override SYM_FUNC_START to insert a BTI * functions have suitable annotations. Override SYM_FUNC_START to insert
* landing pad at the start of everything. * a BTI landing pad at the start of everything.
*/ */
#define SYM_FUNC_START(name) \ #define SYM_FUNC_START(name) \
SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \
......
...@@ -15,7 +15,14 @@ ...@@ -15,7 +15,14 @@
.text .text
nop nop
SYM_FUNC_START(__kernel_rt_sigreturn) /*
* GDB relies on being able to identify the sigreturn instruction sequence to
* unwind from signal handlers. We cannot, therefore, use SYM_FUNC_START()
* here, as it will emit a BTI C instruction and break the unwinder. Thankfully,
* this function is only ever called from a RET and so omitting the landing pad
* is perfectly fine.
*/
SYM_CODE_START(__kernel_rt_sigreturn)
.cfi_startproc .cfi_startproc
.cfi_signal_frame .cfi_signal_frame
.cfi_def_cfa x29, 0 .cfi_def_cfa x29, 0
...@@ -24,6 +31,6 @@ SYM_FUNC_START(__kernel_rt_sigreturn) ...@@ -24,6 +31,6 @@ SYM_FUNC_START(__kernel_rt_sigreturn)
mov x8, #__NR_rt_sigreturn mov x8, #__NR_rt_sigreturn
svc #0 svc #0
.cfi_endproc .cfi_endproc
SYM_FUNC_END(__kernel_rt_sigreturn) SYM_CODE_END(__kernel_rt_sigreturn)
emit_aarch64_feature_1_and emit_aarch64_feature_1_and
...@@ -17,39 +17,39 @@ ...@@ -17,39 +17,39 @@
.save {r0-r15} .save {r0-r15}
.pad #COMPAT_SIGFRAME_REGS_OFFSET .pad #COMPAT_SIGFRAME_REGS_OFFSET
nop nop
SYM_FUNC_START(__kernel_sigreturn_arm) SYM_CODE_START(__kernel_sigreturn_arm)
mov r7, #__NR_compat_sigreturn mov r7, #__NR_compat_sigreturn
svc #0 svc #0
.fnend .fnend
SYM_FUNC_END(__kernel_sigreturn_arm) SYM_CODE_END(__kernel_sigreturn_arm)
.fnstart .fnstart
.save {r0-r15} .save {r0-r15}
.pad #COMPAT_RT_SIGFRAME_REGS_OFFSET .pad #COMPAT_RT_SIGFRAME_REGS_OFFSET
nop nop
SYM_FUNC_START(__kernel_rt_sigreturn_arm) SYM_CODE_START(__kernel_rt_sigreturn_arm)
mov r7, #__NR_compat_rt_sigreturn mov r7, #__NR_compat_rt_sigreturn
svc #0 svc #0
.fnend .fnend
SYM_FUNC_END(__kernel_rt_sigreturn_arm) SYM_CODE_END(__kernel_rt_sigreturn_arm)
.thumb .thumb
.fnstart .fnstart
.save {r0-r15} .save {r0-r15}
.pad #COMPAT_SIGFRAME_REGS_OFFSET .pad #COMPAT_SIGFRAME_REGS_OFFSET
nop nop
SYM_FUNC_START(__kernel_sigreturn_thumb) SYM_CODE_START(__kernel_sigreturn_thumb)
mov r7, #__NR_compat_sigreturn mov r7, #__NR_compat_sigreturn
svc #0 svc #0
.fnend .fnend
SYM_FUNC_END(__kernel_sigreturn_thumb) SYM_CODE_END(__kernel_sigreturn_thumb)
.fnstart .fnstart
.save {r0-r15} .save {r0-r15}
.pad #COMPAT_RT_SIGFRAME_REGS_OFFSET .pad #COMPAT_RT_SIGFRAME_REGS_OFFSET
nop nop
SYM_FUNC_START(__kernel_rt_sigreturn_thumb) SYM_CODE_START(__kernel_rt_sigreturn_thumb)
mov r7, #__NR_compat_rt_sigreturn mov r7, #__NR_compat_rt_sigreturn
svc #0 svc #0
.fnend .fnend
SYM_FUNC_END(__kernel_rt_sigreturn_thumb) SYM_CODE_END(__kernel_rt_sigreturn_thumb)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment