klibc-bot for Ben Hutchings
2020-Jul-25 21:24 UTC
[klibc] [klibc:execstack-fixes] sparc: Set sa_restorer for signals and disable executable stack
Commit-ID: 9370be8552652231e84f8b8424dec81cd8b1b1ab Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=9370be8552652231e84f8b8424dec81cd8b1b1ab Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Thu, 30 Apr 2020 13:56:47 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 25 Jul 2020 17:33:29 +0100 [klibc] sparc: 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/sparc/klibc/archconfig.h | 3 +++ usr/klibc/SYSCALLS.def | 2 +- usr/klibc/arch/sparc/MCONFIG | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/include/arch/sparc/klibc/archconfig.h b/usr/include/arch/sparc/klibc/archconfig.h index 70d5ef08..ab2c5fd7 100644 --- a/usr/include/arch/sparc/klibc/archconfig.h +++ b/usr/include/arch/sparc/klibc/archconfig.h @@ -12,4 +12,7 @@ #define _KLIBC_USE_RT_SIG 1 /* Use rt_* signals */ #define _KLIBC_SYS_SOCKETCALL 1 /* Use sys_socketcall unconditionally */ +/* 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 16faabcb..0768df0d 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -212,7 +212,7 @@ 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(); +<sparc,sparc64> void rt_sigreturn::__sigreturn(); #else int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *); int sigpending(sigset_t *); diff --git a/usr/klibc/arch/sparc/MCONFIG b/usr/klibc/arch/sparc/MCONFIG index cabc7cd4..fb68ba3f 100644 --- a/usr/klibc/arch/sparc/MCONFIG +++ b/usr/klibc/arch/sparc/MCONFIG @@ -18,6 +18,5 @@ KLIBCARCHREQFLAGS += -D__sparc32__ # and call instructions have a 30-bit signed offset, << 2. 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
Reasonably Related Threads
- [klibc:execstack-fixes] sparc: Set sa_restorer for signals and disable executable stack
- [klibc:master] sparc: Set sa_restorer for signals and disable executable stack
- [klibc:execstack-fixes] s390: Set sa_restorer for signals and disable executable stack
- [klibc:execstack-fixes] s390: Set sa_restorer for signals and disable executable stack
- [klibc:execstack-fixes] alpha: Set sa_restorer for signals and disable executable stack