* [RFC PATCH v1 0/5] s390: Signal frame user space unwinding
@ 2026-01-27 15:33 Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 1/5] unwind_user: Enable arch-specific signal frame unwinders Jens Remus
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
This RFC series adds s390 support for unwinding of signal frames in user
space using SFrame V3's indication of signal frames.
Prerequirements:
This series applies on top of the latest unwind user sframe s390 series
"[PATCH v4 00/12] s390: SFrame user space unwinding":
https://lore.kernel.org/all/20260127151926.2805123-1-jremus@linux.ibm.com/
on top of the latest unwind user sframe series
"[PATCH v13 00/18] unwind_deferred: Implement sframe handling":
https://lore.kernel.org/all/20260127150554.2760964-1-jremus@linux.ibm.com/
Like above series it depends on the upcoming binutils 2.46 release to
be used to build executables and libraries (e.g. vDSO) with SFrame V3
on s390 (using the assembler option --gsframe-3).
Overview:
Patches 1 and 2 enables the common unwind user (sframe) frameworks to
support signal frames:
- Patch 1 enables unwind user to resort to an architecture-specific
signal frame unwinder, if a frame is a signal frame.
- Patch 2 adds support to unwind user sframe to provide the signal
frame indication represented in SFrame V3.
Patch 3 annotates the s390 vDSO functions __kernel_[rt_]sigreturn()
as signal frames.
Patch 4 moves the s390 struct [rt_]sigframe to asm/sigframe.h so that
it can be used in unwind user.
Patch 5 enables signal frame unwinding in user space on s390.
Regards,
Jens
Jens Remus (5):
unwind_user: Enable arch-specific signal frame unwinders
unwind_user/sframe: Add support for signal frame indication
s390/vdso: Annotate __kernel_[rt_]sigreturn as signal frames
s390/signal: Move struct [rt_]sigframe to asm/sigframe.h
s390/unwind_user: Enable signal frame unwinding of user space
arch/s390/include/asm/dwarf.h | 3 +
arch/s390/include/asm/sigframe.h | 78 +++++++++++++++++++++++
arch/s390/include/asm/unwind_user.h | 57 +++++++++++++++++
arch/s390/kernel/signal.c | 71 +--------------------
arch/s390/kernel/vdso/vdso_user_wrapper.S | 15 ++++-
arch/x86/include/asm/unwind_user.h | 6 +-
include/linux/unwind_user.h | 9 +++
include/linux/unwind_user_types.h | 1 +
kernel/unwind/sframe.c | 8 ++-
kernel/unwind/sframe.h | 1 +
kernel/unwind/user.c | 4 ++
11 files changed, 178 insertions(+), 75 deletions(-)
create mode 100644 arch/s390/include/asm/sigframe.h
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC PATCH v1 1/5] unwind_user: Enable arch-specific signal frame unwinders
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
@ 2026-01-27 15:33 ` Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 2/5] unwind_user/sframe: Add support for signal frame indication Jens Remus
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
Add a signal flag to struct unwind_user_frame, which indicates whether
the frame is a signal frame. If set unwind_user_common_next() uses an
architecture-specific unwind_user_signal_next() implementation to
unwind the frame.
user unwind sframe will make use of the signal flag in a subsequent
commit.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/x86/include/asm/unwind_user.h | 6 ++++--
include/linux/unwind_user.h | 9 +++++++++
include/linux/unwind_user_types.h | 1 +
kernel/unwind/user.c | 4 ++++
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwind_user.h
index f5e9fbcdae28..21cb9eeb2503 100644
--- a/arch/x86/include/asm/unwind_user.h
+++ b/arch/x86/include/asm/unwind_user.h
@@ -67,7 +67,8 @@ static inline int unwind_user_get_reg(unsigned long *val, unsigned int regnum)
.offset = -2*(ws), \
}, \
.sp_off = 0, \
- .outermost = false,
+ .outermost = false, \
+ .signal = false,
#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \
.cfa = { \
@@ -82,7 +83,8 @@ static inline int unwind_user_get_reg(unsigned long *val, unsigned int regnum)
.rule = UNWIND_USER_RULE_RETAIN,\
}, \
.sp_off = 0, \
- .outermost = false,
+ .outermost = false, \
+ .signal = false,
static inline int unwind_user_fp_get_frame(struct unwind_user_state *state,
struct unwind_user_frame *frame)
diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h
index f65b0573b3a5..eb5de4cb5bd6 100644
--- a/include/linux/unwind_user.h
+++ b/include/linux/unwind_user.h
@@ -34,6 +34,15 @@ static inline int unwind_user_get_reg(unsigned long *val, unsigned int regnum)
#define unwind_user_get_reg unwind_user_get_reg
#endif
+#ifndef unwind_user_signal_next
+static inline int unwind_user_signal_next(struct unwind_user_state *state)
+{
+ WARN_ON_ONCE(1);
+ return -EINVAL;
+}
+#define unwind_user_signal_next unwind_user_signal_next
+#endif
+
int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries);
#endif /* _LINUX_UNWIND_USER_H */
diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_types.h
index fac8f470b597..3985706d7851 100644
--- a/include/linux/unwind_user_types.h
+++ b/include/linux/unwind_user_types.h
@@ -68,6 +68,7 @@ struct unwind_user_frame {
struct unwind_user_rule_data fp;
s32 sp_off;
bool outermost;
+ bool signal;
};
struct unwind_user_state {
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
index a64ceb4a2bf6..b9a3b59e8282 100644
--- a/kernel/unwind/user.c
+++ b/kernel/unwind/user.c
@@ -32,6 +32,10 @@ static int unwind_user_next_common(struct unwind_user_state *state,
{
unsigned long cfa, sp, fp, ra;
+ /* Use signal frame unwinder for signal frames. */
+ if (frame->signal)
+ return unwind_user_signal_next(state);
+
/* Stop unwinding when reaching an outermost frame. */
if (frame->outermost) {
state->done = true;
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH v1 2/5] unwind_user/sframe: Add support for signal frame indication
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 1/5] unwind_user: Enable arch-specific signal frame unwinders Jens Remus
@ 2026-01-27 15:33 ` Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 3/5] s390/vdso: Annotate __kernel_[rt_]sigreturn as signal frames Jens Remus
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
SFrame V3 represents the assembler directive .cfi_signal_frame using
a SFrame FDE flag. Note that a SFrame FDE with this particular flag set
may have no SFrame FREs.
Introduce a SFRAME_V3_FDE_SIGNAL_P() helper macro. Use it in
__find_fre() to populate the signal flag in struct unwind_user_frame,
even if there are no FREs.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
kernel/unwind/sframe.c | 8 +++++++-
kernel/unwind/sframe.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
index 21283e3bda42..9fd2fc1572cc 100644
--- a/kernel/unwind/sframe.c
+++ b/kernel/unwind/sframe.c
@@ -446,6 +446,7 @@ static __always_inline int __find_fre(struct sframe_section *sec,
struct unwind_user_frame *frame)
{
unsigned char fde_pctype = SFRAME_V3_FDE_PCTYPE(fde->info);
+ bool signal = SFRAME_V3_FDE_SIGNAL_P(fde->info);
struct sframe_fre_internal *fre, *prev_fre = NULL;
struct sframe_fre_internal fres[2];
unsigned long fre_addr;
@@ -486,8 +487,11 @@ static __always_inline int __find_fre(struct sframe_section *sec,
prev_fre = fre;
}
- if (!prev_fre)
+ if (!prev_fre) {
+ if (signal)
+ goto signal;
return -EINVAL;
+ }
fre = prev_fre;
ret = __read_fre_datawords(sec, fde, fre);
@@ -500,6 +504,8 @@ static __always_inline int __find_fre(struct sframe_section *sec,
sframe_init_rule_data(&frame->fp, fre->fp_ctl, fre->fp_off);
frame->sp_off = SFRAME_SP_OFFSET;
frame->outermost = SFRAME_V3_FRE_RA_UNDEFINED_P(fre->info);
+signal:
+ frame->signal = signal;
return 0;
}
diff --git a/kernel/unwind/sframe.h b/kernel/unwind/sframe.h
index 8a5322e95403..78432857f84c 100644
--- a/kernel/unwind/sframe.h
+++ b/kernel/unwind/sframe.h
@@ -65,6 +65,7 @@ struct sframe_fda_v3 {
#define SFRAME_V3_FDE_FRE_TYPE(info) ((info) & 0xf)
#define SFRAME_V3_FDE_PCTYPE(info) (((info) >> 4) & 0x1)
#define SFRAME_V3_AARCH64_FDE_PAUTH_KEY(info) (((info) >> 5) & 0x1)
+#define SFRAME_V3_FDE_SIGNAL_P(info) (((info) >> 7) & 0x1)
#define SFRAME_FDE_TYPE_REGULAR 0
#define SFRAME_FDE_TYPE_FLEXIBLE 1
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH v1 3/5] s390/vdso: Annotate __kernel_[rt_]sigreturn as signal frames
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 1/5] unwind_user: Enable arch-specific signal frame unwinders Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 2/5] unwind_user/sframe: Add support for signal frame indication Jens Remus
@ 2026-01-27 15:33 ` Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 4/5] s390/signal: Move struct [rt_]sigframe to asm/sigframe.h Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 5/5] s390/unwind_user: Enable signal frame unwinding of user space Jens Remus
4 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
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 <jremus@linux.ibm.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH v1 4/5] s390/signal: Move struct [rt_]sigframe to asm/sigframe.h
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
` (2 preceding siblings ...)
2026-01-27 15:33 ` [RFC PATCH v1 3/5] s390/vdso: Annotate __kernel_[rt_]sigreturn as signal frames Jens Remus
@ 2026-01-27 15:33 ` Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 5/5] s390/unwind_user: Enable signal frame unwinding of user space Jens Remus
4 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
This enables use of struct sigframe and struct rt_sigframe elsewhere,
such as unwind user.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/s390/include/asm/sigframe.h | 78 ++++++++++++++++++++++++++++++++
arch/s390/kernel/signal.c | 71 +----------------------------
2 files changed, 79 insertions(+), 70 deletions(-)
create mode 100644 arch/s390/include/asm/sigframe.h
diff --git a/arch/s390/include/asm/sigframe.h b/arch/s390/include/asm/sigframe.h
new file mode 100644
index 000000000000..7539fd802675
--- /dev/null
+++ b/arch/s390/include/asm/sigframe.h
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef _ASM_S390_SIGFRAME_H
+#define _ASM_S390_SIGFRAME_H
+
+#include <uapi/asm/sigcontext.h>
+#include <asm/ucontext.h>
+
+/*
+ * Layout of an old-style signal-frame:
+ * -----------------------------------------
+ * | save area (_SIGNAL_FRAMESIZE) |
+ * -----------------------------------------
+ * | struct sigcontext |
+ * | oldmask |
+ * | _sigregs * |
+ * -----------------------------------------
+ * | _sigregs with |
+ * | _s390_regs_common |
+ * | _s390_fp_regs |
+ * -----------------------------------------
+ * | int signo |
+ * -----------------------------------------
+ * | _sigregs_ext with |
+ * | gprs_high 64 byte (opt) |
+ * | vxrs_low 128 byte (opt) |
+ * | vxrs_high 256 byte (opt) |
+ * | reserved 128 byte (opt) |
+ * -----------------------------------------
+ * | __u16 svc_insn |
+ * -----------------------------------------
+ * The svc_insn entry with the sigreturn system call opcode does not
+ * have a fixed position and moves if gprs_high or vxrs exist.
+ * Future extensions will be added to _sigregs_ext.
+ */
+struct sigframe
+{
+ __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
+ struct sigcontext sc;
+ _sigregs sregs;
+ int signo;
+ _sigregs_ext sregs_ext;
+ __u16 svc_insn; /* Offset of svc_insn is NOT fixed! */
+};
+
+/*
+ * Layout of an rt signal-frame:
+ * -----------------------------------------
+ * | save area (_SIGNAL_FRAMESIZE) |
+ * -----------------------------------------
+ * | svc __NR_rt_sigreturn 2 byte |
+ * -----------------------------------------
+ * | struct siginfo |
+ * -----------------------------------------
+ * | struct ucontext_extended with |
+ * | unsigned long uc_flags |
+ * | struct ucontext *uc_link |
+ * | stack_t uc_stack |
+ * | _sigregs uc_mcontext with |
+ * | _s390_regs_common |
+ * | _s390_fp_regs |
+ * | sigset_t uc_sigmask |
+ * | _sigregs_ext uc_mcontext_ext |
+ * | gprs_high 64 byte (opt) |
+ * | vxrs_low 128 byte (opt) |
+ * | vxrs_high 256 byte (opt)|
+ * | reserved 128 byte (opt) |
+ * -----------------------------------------
+ * Future extensions will be added to _sigregs_ext.
+ */
+struct rt_sigframe
+{
+ __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
+ __u16 svc_insn;
+ struct siginfo info;
+ struct ucontext_extended uc;
+};
+
+#endif /* _ASM_S390_SIGFRAME_H */
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 4874de5edea0..42675066399f 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -32,78 +32,9 @@
#include <asm/vdso-symbols.h>
#include <asm/access-regs.h>
#include <asm/lowcore.h>
+#include <asm/sigframe.h>
#include "entry.h"
-/*
- * Layout of an old-style signal-frame:
- * -----------------------------------------
- * | save area (_SIGNAL_FRAMESIZE) |
- * -----------------------------------------
- * | struct sigcontext |
- * | oldmask |
- * | _sigregs * |
- * -----------------------------------------
- * | _sigregs with |
- * | _s390_regs_common |
- * | _s390_fp_regs |
- * -----------------------------------------
- * | int signo |
- * -----------------------------------------
- * | _sigregs_ext with |
- * | gprs_high 64 byte (opt) |
- * | vxrs_low 128 byte (opt) |
- * | vxrs_high 256 byte (opt) |
- * | reserved 128 byte (opt) |
- * -----------------------------------------
- * | __u16 svc_insn |
- * -----------------------------------------
- * The svc_insn entry with the sigreturn system call opcode does not
- * have a fixed position and moves if gprs_high or vxrs exist.
- * Future extensions will be added to _sigregs_ext.
- */
-struct sigframe
-{
- __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
- struct sigcontext sc;
- _sigregs sregs;
- int signo;
- _sigregs_ext sregs_ext;
- __u16 svc_insn; /* Offset of svc_insn is NOT fixed! */
-};
-
-/*
- * Layout of an rt signal-frame:
- * -----------------------------------------
- * | save area (_SIGNAL_FRAMESIZE) |
- * -----------------------------------------
- * | svc __NR_rt_sigreturn 2 byte |
- * -----------------------------------------
- * | struct siginfo |
- * -----------------------------------------
- * | struct ucontext_extended with |
- * | unsigned long uc_flags |
- * | struct ucontext *uc_link |
- * | stack_t uc_stack |
- * | _sigregs uc_mcontext with |
- * | _s390_regs_common |
- * | _s390_fp_regs |
- * | sigset_t uc_sigmask |
- * | _sigregs_ext uc_mcontext_ext |
- * | gprs_high 64 byte (opt) |
- * | vxrs_low 128 byte (opt) |
- * | vxrs_high 256 byte (opt)|
- * | reserved 128 byte (opt) |
- * -----------------------------------------
- * Future extensions will be added to _sigregs_ext.
- */
-struct rt_sigframe
-{
- __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
- __u16 svc_insn;
- struct siginfo info;
- struct ucontext_extended uc;
-};
-
/* Store registers needed to create the signal frame */
static void store_sigregs(void)
{
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH v1 5/5] s390/unwind_user: Enable signal frame unwinding of user space
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
` (3 preceding siblings ...)
2026-01-27 15:33 ` [RFC PATCH v1 4/5] s390/signal: Move struct [rt_]sigframe to asm/sigframe.h Jens Remus
@ 2026-01-27 15:33 ` Jens Remus
4 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2026-01-27 15:33 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, linux-s390, bpf, x86,
Steven Rostedt
Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich,
Josh Poimboeuf, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Indu Bhagat,
Jose E. Marchesi, Beau Belgrave, Linus Torvalds, Andrew Morton,
Florian Weimer, Kees Cook, Carlos O'Donell, Sam James,
Dylan Hatch
Provide a s390-specific implementation of unwind_user_signal_next(),
that unwinds from a (RT) signal frame.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/s390/include/asm/unwind_user.h | 57 +++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/arch/s390/include/asm/unwind_user.h b/arch/s390/include/asm/unwind_user.h
index a7b97ea01c26..8f5524a24ae1 100644
--- a/arch/s390/include/asm/unwind_user.h
+++ b/arch/s390/include/asm/unwind_user.h
@@ -7,6 +7,7 @@
#include <linux/types.h>
#include <asm/asm-offsets.h>
#include <asm/fpu.h>
+#include <asm/sigframe.h>
#include <asm/stacktrace.h>
#include <linux/unwind_user_types.h>
@@ -67,6 +68,62 @@ static inline int arch_unwind_user_get_reg(unsigned long *val,
}
#define unwind_user_get_reg arch_unwind_user_get_reg
+#define SVC_OPCODE 0x0a
+#define INSN_SVC_SIGRETURN ((SVC_OPCODE << 8) | __NR_sigreturn)
+#define INSN_SVC_RT_SIGRETURN ((SVC_OPCODE << 8) | __NR_rt_sigreturn)
+
+static inline int unwind_user_signal_next(struct unwind_user_state *state)
+{
+ unsigned short insn;
+ const _sigregs __user *sr;
+ unsigned long sp, fp, ra;
+
+ /* ABI requires IP to be 2-byte aligned. */
+ if (state->ip & 1)
+ return -EINVAL;
+
+ if (__get_user(insn, (unsigned short __user *)state->ip))
+ return -EINVAL;
+
+ /*
+ * A signal frame has the instruction pointer pointing to
+ * svc $__NR_sigreturn or svc $__NR_rt_sigreturn
+ */
+ switch (insn) {
+ case INSN_SVC_SIGRETURN:
+ /* New-style non-RT frame. */
+ const struct sigframe __user *sf;
+
+ sf = (struct sigframe __user *)state->sp;
+ if (__get_user(sr, (_sigregs __user **)&sf->sc.sregs))
+ return -EINVAL;
+ break;
+ case INSN_SVC_RT_SIGRETURN:
+ /* New-style RT frame. */
+ const struct rt_sigframe __user *rt_sf;
+
+ rt_sf = (struct rt_sigframe __user *)state->sp;
+ sr = (_sigregs __user *)&rt_sf->uc.uc_mcontext;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (__get_user(sp, (unsigned long __user *)&sr->regs.gprs[15]))
+ return -EINVAL;
+ if (__get_user(fp, (unsigned long __user *)&sr->regs.gprs[11]))
+ return -EINVAL;
+ if (__get_user(ra, (unsigned long __user *)&sr->regs.psw.addr))
+ return -EINVAL;
+
+ state->ip = ra;
+ state->sp = sp;
+ state->fp = fp;
+ state->topmost = false;
+ return 0;
+}
+#define unwind_user_signal_next unwind_user_signal_next
+
#endif /* CONFIG_UNWIND_USER */
#ifdef CONFIG_HAVE_UNWIND_USER_FP
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-27 15:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 15:33 [RFC PATCH v1 0/5] s390: Signal frame user space unwinding Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 1/5] unwind_user: Enable arch-specific signal frame unwinders Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 2/5] unwind_user/sframe: Add support for signal frame indication Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 3/5] s390/vdso: Annotate __kernel_[rt_]sigreturn as signal frames Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 4/5] s390/signal: Move struct [rt_]sigframe to asm/sigframe.h Jens Remus
2026-01-27 15:33 ` [RFC PATCH v1 5/5] s390/unwind_user: Enable signal frame unwinding of user space Jens Remus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox