mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: [PATCH 0/2] sigaltstack conformance fixes
Date: Wed, 7 Feb 2018 02:04:33 +0100	[thread overview]
Message-ID: <20180207010432.GP4418@port70.net> (raw)

[-- 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


                 reply	other threads:[~2018-02-07  1:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180207010432.GP4418@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).