Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171110205901.18401-1-koorogi@koorogi.info>
Date: Fri, 10 Nov 2017 14:59:01 -0600
From: Bobby Bingham <koorogi@...rogi.info>
To: musl@...ts.openwall.com
Subject: [PATCH] [libc-test] test sigsetjmp with savesigs=0

---
 src/functional/setjmp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/functional/setjmp.c b/src/functional/setjmp.c
index 0a9e4e6..adba1a6 100644
--- a/src/functional/setjmp.c
+++ b/src/functional/setjmp.c
@@ -46,5 +46,20 @@ int main(void)
 	sigprocmask(SIG_SETMASK, &set, &set);
 	TEST(sigismember(&set, SIGUSR1)==0, "siglongjmp failed to restore mask\n");

+	sigemptyset(&set);
+	sigaddset(&set, SIGUSR1);
+	sigprocmask(SIG_UNBLOCK, &set, &set);
+	oldset = set;
+
+	if (!sigsetjmp(sjb, 0)) {
+		sigemptyset(&set);
+		sigaddset(&set, SIGUSR1);
+		sigprocmask(SIG_BLOCK, &set, 0);
+		siglongjmp(sjb, 1);
+	}
+	set = oldset;
+	sigprocmask(SIG_SETMASK, &set, &set);
+	TEST(sigismember(&set, SIGUSR1)==1, "siglongjmp incorrectly restored mask\n");
+
 	return t_status;
 }
--
2.15.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.