mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 0/2] sigaltstack conformance fixes
@ 2018-02-07  1:04 Szabolcs Nagy
  0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2018-02-07  1:04 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

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


[-- Attachment #2: 0001-signal.h-remove-SS_AUTODISARM.patch --]
[-- Type: text/x-diff, Size: 1068 bytes --]

From 931fc1beb33bc52c4424c25649aa8321aa5372c5 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
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 <nsz@port70.net>
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


[-- Attachment #3: 0002-fix-error-checks-in-sigaltstack.patch --]
[-- Type: text/x-diff, Size: 1120 bytes --]

From c469f3741558427f3f82042ff4d1328e22e25795 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-07  1:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07  1:04 [PATCH 0/2] sigaltstack conformance fixes Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).