aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2020-04-30 03:38:34 +0100
committerBen Hutchings <ben@decadent.org.uk>2020-08-27 15:00:33 +0100
commitc341c978e3024b9c575fac94012fc5b6f5679334 (patch)
tree60be6fa1fb1f7b45706fe2d35c45b8354ebe88fb
parent2a2a0b6b79c2470f529daabd5c193f58fe188337 (diff)
downloadklibc-c341c978e3024b9c575fac94012fc5b6f5679334.tar.gz
[klibc] s390: Set sa_restorer for signals and disable executable stack
s390 allows specifiying a signal restorer in the usual way. We should do this to avoid needing an executable stack. * Define a __sigreturn() routine that calls rt_sigreturn * Force the SA_RESTORER flag on for all signal handlers, and set __sigreturn as the restorer if none is already set * Force the SA_SIGINFO flag on for all signal handlers, so that we can always return from them with rt_sigreturn * Set KLIBCEXECSTACK=n Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--usr/include/arch/s390/klibc/archconfig.h5
-rw-r--r--usr/klibc/SYSCALLS.def2
-rw-r--r--usr/klibc/arch/s390/MCONFIG5
3 files changed, 8 insertions, 4 deletions
diff --git a/usr/include/arch/s390/klibc/archconfig.h b/usr/include/arch/s390/klibc/archconfig.h
index d7a71a4b920771..b08bbb3ff80c20 100644
--- a/usr/include/arch/s390/klibc/archconfig.h
+++ b/usr/include/arch/s390/klibc/archconfig.h
@@ -12,4 +12,9 @@
/* Both s390 and s390x use the "32-bit" version of this structure */
#define _KLIBC_STATFS_F_TYPE_64 0
+/* So that we can avoid stack trampolines */
+#define _KLIBC_NEEDS_SA_RESTORER 1
+/* Our restorer will call rt_sigreturn() */
+#define _KLIBC_NEEDS_SA_SIGINFO 1
+
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def
index 461d9bf6111960..30ff58b88d98e3 100644
--- a/usr/klibc/SYSCALLS.def
+++ b/usr/klibc/SYSCALLS.def
@@ -212,7 +212,6 @@ ssize_t sendfile64,sendfile::sendfile(int, int, off_t *, size_t, off_t);
int rt_sigsuspend::__rt_sigsuspend(const sigset_t *, size_t);
int rt_sigpending::__rt_sigpending(sigset_t *, size_t);
int rt_sigprocmask::__rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
-<sparc64> void rt_sigreturn::__sigreturn();
#else
int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *);
int sigpending(sigset_t *);
@@ -229,6 +228,7 @@ int sigprocmask(int, const sigset_t *, sigset_t *);
<sh,sparc,alpha,ppc,sparc64> int sigsuspend::__sigsuspend_s(sigset_t);
<arm,frv,i386,m68k,mn10300,s390,s390x> int sigsuspend::__sigsuspend_xxs(int, int, sigset_t);
#endif
+<s390,s390x,sparc64> void rt_sigreturn::__sigreturn();
int kill(pid_t, int);
<?> unsigned int alarm(unsigned int);
int getitimer(int, struct itimerval *);
diff --git a/usr/klibc/arch/s390/MCONFIG b/usr/klibc/arch/s390/MCONFIG
index c36acd7a30f720..7ffbcc4579e1d5 100644
--- a/usr/klibc/arch/s390/MCONFIG
+++ b/usr/klibc/arch/s390/MCONFIG
@@ -22,6 +22,5 @@ endif
KLIBCASMARCH = s390
KLIBCSHAREDFLAGS = -Ttext-segment 0x40000000
-# Kernel uses stack trampoline for signal return unless we set
-# sa_restorer
-KLIBCEXECSTACK := y
+# Kernel uses our sa_restorer for signal return
+KLIBCEXECSTACK := n