From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11179 Path: news.gmane.org!.POSTED!not-for-mail From: Yousong Zhou Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] pthread_sigmask: check 'how' only when 'set' is not NULL Date: Wed, 22 Mar 2017 20:19:43 +0800 Message-ID: <1490185183-17680-1-git-send-email-yszhou4tech@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1490185196 540 195.159.176.226 (22 Mar 2017 12:19:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 22 Mar 2017 12:19:56 +0000 (UTC) Cc: musl@lists.openwall.com, Yousong Zhou To: dalias@libc.org Original-X-From: musl-return-11194-gllmg-musl=m.gmane.org@lists.openwall.com Wed Mar 22 13:19:52 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cqfEy-0007rz-S4 for gllmg-musl@m.gmane.org; Wed, 22 Mar 2017 13:19:48 +0100 Original-Received: (qmail 24423 invoked by uid 550); 22 Mar 2017 12:19:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24397 invoked from network); 22 Mar 2017 12:19:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9mEtfFli1q0Z5yJcbRw9I4VKhHcCNO/Rys6hE6FaX6k=; b=ainvGfDSbU9IzQ8qG2CH3jdW4ONmK4LeVNp95PaI1707LVO6ekc1OerAp7EvfI3+3+ p6hhjpQcrjrXH8AiPKIN8ZSDPzhiX8SGojlPEhx2g1IhQs05geUxEEqIyprBkhmtIWrM lv0mmz7B1IbtJfysHGfaCg6PZUszcQE2xhck/T4AsuzAZZkZjjojbu8wPMtZSoa9ZEjT Vvx67Yp+MaFgoESBYwxVu/KOS8bgks/4Zc9kaDDXUB6e5DhZbL+n1TOgSurEywIx6Idr c6cqUSSqe1gEwHJWw4gs+J1wMC+QhrjmO/mopXP72umWojxYrbWrpnJMORInC80CvnyG j/Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9mEtfFli1q0Z5yJcbRw9I4VKhHcCNO/Rys6hE6FaX6k=; b=Gsi1rj+Kl4uaRDppcXOrW1b9P6yd4kWHxhgJ4JYl6DdI0rcG08aXKQGM0iX7CFC0EF eWuTY7n7M22G9VLM5nmVT7WLBPi6NjawcCW1cJYzM+d/YFzKPWYLhpU0g2NqwGehDwaA B/9QfyXKfl7+R4mrscXYsV4wR+iGZTESJf6v1gMVHjg7sqFWNL6FzOo47W+MWUKjOwoy FQpIKBAsQV8kMr0TkcBCDfE9UxfeBJxZNNSklsDP9lH6ABKQ9aHlKLF2QVnmGWxuG7Cb QnpUbo48ZPLS2oPQm+VgLvQwqwdw1KtKdZu9kdTlhxaCMInpzQynqHdwo9lBJOtpVYl7 3P2Q== X-Gm-Message-State: AFeK/H0DeuSlntjypKnuNzF4xSlm5iLjn5VVIj2hzEVsMwMHFase5QbwKGq/lpZ3mHqelw== X-Received: by 10.84.248.74 with SMTP id e10mr9754801pln.133.1490185178442; Wed, 22 Mar 2017 05:19:38 -0700 (PDT) X-Mailer: git-send-email 2.6.4 Xref: news.gmane.org gmane.linux.lib.musl.general:11179 Archived-At: 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) { -- 2.6.4