[klibc] [klibc:execstack-fixes] s390: Set sa_restorer for signals and disable executable stack
klibc-bot for Ben Hutchings
ben at decadent.org.uk
Sat Jul 25 14:24:02 PDT 2020
Commit-ID: ed8a58947232eab57ce42219f07ca451dcfdd214
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=ed8a58947232eab57ce42219f07ca451dcfdd214
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: Sat, 25 Jul 2020 17:33:29 +0100
[klibc] s390: Set sa_restorer for signals and disable executable stack
Add a __sigreturn stub and point sa_restorer to it by default, so
that the kernel doesn't create stack trampolines for signal return.
With that done, we no longer need an executable stack.
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/include/arch/s390/klibc/archconfig.h | 3 +++
usr/klibc/SYSCALLS.def | 1 +
usr/klibc/arch/s390/MCONFIG | 5 ++---
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/usr/include/arch/s390/klibc/archconfig.h b/usr/include/arch/s390/klibc/archconfig.h
index d7a71a4b..4c45f98a 100644
--- a/usr/include/arch/s390/klibc/archconfig.h
+++ b/usr/include/arch/s390/klibc/archconfig.h
@@ -12,4 +12,7 @@
/* 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
+
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def
index 461d9bf6..16faabcb 100644
--- a/usr/klibc/SYSCALLS.def
+++ b/usr/klibc/SYSCALLS.def
@@ -228,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);
+<s390> void sigreturn::__sigreturn();
#endif
int kill(pid_t, int);
<?> unsigned int alarm(unsigned int);
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