mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bobby Bingham <koorogi@koorogi.info>
To: musl@lists.openwall.com
Subject: [PATCH] [libc-test] test sigsetjmp with savesigs=0
Date: Fri, 10 Nov 2017 14:59:01 -0600	[thread overview]
Message-ID: <20171110205901.18401-1-koorogi@koorogi.info> (raw)

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



             reply	other threads:[~2017-11-10 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 20:59 Bobby Bingham [this message]
2018-02-07 21:00 ` Szabolcs Nagy

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=20171110205901.18401-1-koorogi@koorogi.info \
    --to=koorogi@koorogi.info \
    --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).