From fe70a508fe945cb1a44f8a6bbd87ee295637447b Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Tue, 9 Jul 2019 14:59:01 -0400 Subject: [PATCH] Fix the use of sigaltstack to return to the saved main stack. Previously, musl would reject the call, because the main stack has ss_size == 0 and ss_flags == SS_DISABLE. We could condition on ss_flags not containing SS_DISABLE, but instead, simply remove the ss_size check, as the kernel performs the same check, anyhow. --- src/signal/sigaltstack.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c index cfa3f5c1..d8e8eb0b 100644 --- a/src/signal/sigaltstack.c +++ b/src/signal/sigaltstack.c @@ -4,15 +4,9 @@ int sigaltstack(const stack_t *restrict ss, stack_t *restrict old) { - if (ss) { - if (ss->ss_size < MINSIGSTKSZ) { - errno = ENOMEM; - return -1; - } - if (ss->ss_flags & SS_ONSTACK) { - errno = EINVAL; - return -1; - } + if (ss && (ss->ss_flags & SS_ONSTACK)) { + errno = EINVAL; + return -1; } return syscall(SYS_sigaltstack, ss, old); } -- 2.22.0.410.gd8fdbe21b5-goog