[klibc] [klibc:master] s390: Set sa_restorer for signals and disable executable stack
klibc-bot for Ben Hutchings
ben at decadent.org.uk
Thu Aug 27 09:21:09 PDT 2020
Commit-ID: c341c978e3024b9c575fac94012fc5b6f5679334
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=c341c978e3024b9c575fac94012fc5b6f5679334
Author: Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Thu, 30 Apr 2020 03:38:34 +0100
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Thu, 27 Aug 2020 15:00:33 +0100
[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 at decadent.org.uk>
---
usr/include/arch/s390/klibc/archconfig.h | 5 +++++
usr/klibc/SYSCALLS.def | 2 +-
usr/klibc/arch/s390/MCONFIG | 5 ++---
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 d7a71a4b..b08bbb3f 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 461d9bf6..30ff58b8 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 c36acd7a..7ffbcc45 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
More information about the klibc
mailing list