The GNU assembler supports CFI directive .cfi_signal_frame with
binutils 2.17+.  Use it to annotate the vDSO functions
__kernel_sigreturn() and __kernel_rt_sigreturn() as signal
frames.

This enables generation of SFrame stack trace information for the
vDSO to likewise annotate these functions for use in stack tracers,
such as the kernel unwind user sframe.

Signed-off-by: Jens Remus <[email protected]>
---
 arch/s390/include/asm/dwarf.h             |  3 +++
 arch/s390/kernel/vdso/vdso_user_wrapper.S | 15 +++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/dwarf.h b/arch/s390/include/asm/dwarf.h
index 2f148b15fd7d..e5663d6b11db 100644
--- a/arch/s390/include/asm/dwarf.h
+++ b/arch/s390/include/asm/dwarf.h
@@ -35,6 +35,8 @@
 #define CFI_VAL_OFFSET         nocfi
 #endif
 
+#define CFI_SIGNAL_FRAME       .cfi_signal_frame
+
 #else /* !BUILD_VDSO */
 
 /*
@@ -49,6 +51,7 @@
 #define CFI_RESTORE            nocfi
 #define CFI_REL_OFFSET         nocfi
 #define CFI_VAL_OFFSET         nocfi
+#define CFI_SIGNAL_FRAME       nocfi
 
 #endif /* !BUILD_VDSO */
 
diff --git a/arch/s390/kernel/vdso/vdso_user_wrapper.S 
b/arch/s390/kernel/vdso/vdso_user_wrapper.S
index aa06c85bcbd3..757503929ab0 100644
--- a/arch/s390/kernel/vdso/vdso_user_wrapper.S
+++ b/arch/s390/kernel/vdso/vdso_user_wrapper.S
@@ -47,6 +47,17 @@ SYM_FUNC_START(__kernel_\func)
 SYM_FUNC_END(__kernel_\func)
 .endm
 
+.macro vdso_syscall_sf func,syscall
+SYM_FUNC_START(__kernel_\func)
+       CFI_STARTPROC simple
+       CFI_SIGNAL_FRAME
+       svc     \syscall
+       /* Trap, if syscall returns, which shouldn't happen */
+       .insn e,0x0000
+       CFI_ENDPROC
+SYM_FUNC_END(__kernel_\func)
+.endm
+
 vdso_syscall restart_syscall,__NR_restart_syscall
-vdso_syscall sigreturn,__NR_sigreturn
-vdso_syscall rt_sigreturn,__NR_rt_sigreturn
+vdso_syscall_sf sigreturn,__NR_sigreturn
+vdso_syscall_sf rt_sigreturn,__NR_rt_sigreturn
-- 
2.51.0


Reply via email to