From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12471 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 0/2] sigaltstack conformance fixes Date: Wed, 7 Feb 2018 02:04:33 +0100 Message-ID: <20180207010432.GP4418@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" X-Trace: blaine.gmane.org 1517965386 13824 195.159.176.226 (7 Feb 2018 01:03:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2018 01:03:06 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) To: musl@lists.openwall.com Original-X-From: musl-return-12487-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 07 02:03:01 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1ejE8M-0002OR-3K for gllmg-musl@m.gmane.org; Wed, 07 Feb 2018 02:02:46 +0100 Original-Received: (qmail 30228 invoked by uid 550); 7 Feb 2018 01:04:47 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30125 invoked from network); 7 Feb 2018 01:04:45 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline Xref: news.gmane.org gmane.linux.lib.musl.general:12471 Archived-At: --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline linux SS_AUTODISARM is non-conforming so remove it. i opened http://austingroupbugs.net/view.php?id=1187 Szabolcs Nagy (2): signal.h: remove SS_AUTODISARM fix error checks in sigaltstack include/signal.h | 2 -- src/signal/sigaltstack.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) -- 2.15.0 --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-signal.h-remove-SS_AUTODISARM.patch" >From 931fc1beb33bc52c4424c25649aa8321aa5372c5 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 6 Feb 2018 23:46:55 +0000 Subject: [PATCH 1/2] signal.h: remove SS_AUTODISARM this is the revert of commit 9680e1d03a794b0e0d5815c749478228ed40a36d Author: Szabolcs Nagy Date: 2016-08-20 17:04:44 +0200 add SS_AUTODISARM sigaltstack ss_flags from linux v4.7 to signal.h because it's not possible to support this feature in a conforming way given the posix requirements about ss_flags handling in sigaltstack, see http://www.openwall.com/lists/musl/2017/12/23/3 --- include/signal.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/signal.h b/include/signal.h index 2c8b3d55..a16094c5 100644 --- a/include/signal.h +++ b/include/signal.h @@ -239,8 +239,6 @@ void (*sigset(int, void (*)(int)))(int); #define POLL_HUP 6 #define SS_ONSTACK 1 #define SS_DISABLE 2 -#define SS_AUTODISARM (1U << 31) -#define SS_FLAG_BITS SS_AUTODISARM #endif #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -- 2.15.0 --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-fix-error-checks-in-sigaltstack.patch" >From c469f3741558427f3f82042ff4d1328e22e25795 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 7 Feb 2018 00:01:02 +0000 Subject: [PATCH 2/2] fix error checks in sigaltstack ss_size should not be checked if SS_DISABLE is set in ss->ss_flags and posix requires other flags to fail. the posix requirement may be too strict here, but musl should follow the spec until that's resolved: http://austingroupbugs.net/view.php?id=1187 --- src/signal/sigaltstack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c index 62cb81ad..017b53bc 100644 --- a/src/signal/sigaltstack.c +++ b/src/signal/sigaltstack.c @@ -4,13 +4,13 @@ int sigaltstack(const stack_t *restrict ss, stack_t *restrict old) { - if (ss) { - if (ss->ss_size < MINSIGSTKSZ) { - errno = ENOMEM; + if (ss && ss->ss_flags != SS_DISABLE) { + if (ss->ss_flags) { + errno = EINVAL; return -1; } - if (ss->ss_flags & ~SS_DISABLE) { - errno = EINVAL; + if (ss->ss_size < MINSIGSTKSZ) { + errno = ENOMEM; return -1; } } -- 2.15.0 --azLHFNyN32YCQGCU--