|
|
Message-ID: <20261102165837.24591-5-kaloz@kernel.org>
Date: Mon, 2 Nov 2026 17:58:31 +0100
From: Imre Kaloz <kaloz@...nel.org>
To: musl@...ts.openwall.com
Subject: [PATCH 04/10] add SYSCALL_RT_SIGACTION_RESTORER hook for sparc
sparc's rt_sigaction takes the restorer as a fourth argument, before
sigsetsize, and has no SA_RESTORER; the kernel reads it only when an
action is installed. sparc32 builds an rt frame only for SA_SIGINFO
handlers and returns from the two frames by different syscalls, so the
restorer follows SA_SIGINFO.
---
src/signal/sigaction.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c
index e45308fa..2404279a 100644
--- a/src/signal/sigaction.c
+++ b/src/signal/sigaction.c
@@ -20,6 +20,9 @@ volatile int __eintr_valid_flag;
int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
{
struct k_sigaction ksa, ksa_old;
+#ifdef SYSCALL_RT_SIGACTION_RESTORER
+ void (*restorer)(void) = __restore_rt;
+#endif
if (sa) {
if ((uintptr_t)sa->sa_handler > 1UL) {
a_or_l(handler_set+(sig-1)/(8*sizeof(long)),
@@ -48,10 +51,19 @@ int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigact
#ifdef SA_RESTORER
ksa.flags |= SA_RESTORER;
ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
+#endif
+#ifdef SYSCALL_RT_SIGACTION_RESTORER
+ restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
+ ksa.restorer = restorer;
#endif
memcpy(&ksa.mask, &sa->sa_mask, _NSIG/8);
}
+#ifdef SYSCALL_RT_SIGACTION_RESTORER
+ int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0,
+ restorer, _NSIG/8);
+#else
int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, _NSIG/8);
+#endif
if (old && !r) {
old->sa_handler = ksa_old.handler;
old->sa_flags = ksa_old.flags;
--
2.47.3
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.