From: Rich Felker Date: Tue, 5 Mar 2019 16:02:15 +0000 (-0500) Subject: don't reject unknown/future flags in sigaltstack, allow SS_AUTODISARM X-Git-Tag: v1.1.22~42 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4918b7fb0d9f3d3fd4b46be3313901fbd772064b;p=oweals%2Fmusl.git don't reject unknown/future flags in sigaltstack, allow SS_AUTODISARM historically, and likely accidentally, sigaltstack was specified to fail with EINVAL if any flag bit other than SS_DISABLE was set. the resolution of Austin Group issue 1187 fixes this so that the requirement is only to fail for SS_ONSTACK (which cannot be set) or "invalid" flags. Linux fails on the kernel side for invalid flags, but historically accepts SS_ONSTACK as a no-op, so it needs to be rejected in userspace still. with this change, the Linux-specific SS_AUTODISARM, provided since commit 9680e1d03a794b0e0d5815c749478228ed40a36d but unusable due to rejection at runtime, is now usable. --- diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c index 62cb81ad..cfa3f5c1 100644 --- a/src/signal/sigaltstack.c +++ b/src/signal/sigaltstack.c @@ -9,7 +9,7 @@ int sigaltstack(const stack_t *restrict ss, stack_t *restrict old) errno = ENOMEM; return -1; } - if (ss->ss_flags & ~SS_DISABLE) { + if (ss->ss_flags & SS_ONSTACK) { errno = EINVAL; return -1; }