Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 22 Mar 2017 20:19:43 +0800
From: Yousong Zhou <>
	Yousong Zhou <>
Subject: [PATCH] pthread_sigmask: check 'how' only when 'set' is not NULL

According to POSIX document

    If set is a null pointer, the value of the argument how is not
    significant and the thread's signal mask shall be unchanged; thus
    the call can be used to enquire about currently blocked signals.

This is also how the current Linux kernel syscall is doing.  So the
following function call from binutils-gdb should not fail

    sigprocmask (0,  NULL, &original_signal_mask);
 src/thread/pthread_sigmask.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/thread/pthread_sigmask.c b/src/thread/pthread_sigmask.c
index 88c333f..f188782 100644
--- a/src/thread/pthread_sigmask.c
+++ b/src/thread/pthread_sigmask.c
@@ -5,7 +5,7 @@
 int pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
 	int ret;
-	if ((unsigned)how - SIG_BLOCK > 2U) return EINVAL;
+	if (set && (unsigned)how - SIG_BLOCK > 2U) return EINVAL;
 	ret = -__syscall(SYS_rt_sigprocmask, how, set, old, _NSIG/8);
 	if (!ret && old) {
 		if (sizeof old->__bits[0] == 8) {

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.