From patchwork Thu Dec 5 18:34:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 180902 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2343696ile; Thu, 5 Dec 2019 10:35:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxAqQsl952CzcyxU/s2QdnIex7wLRNw7i2NUeO9xAzYTUTAmjYMR7UGzM2TdcZ79hFvFTD2 X-Received: by 2002:aca:b7c4:: with SMTP id h187mr2832080oif.4.1575570918583; Thu, 05 Dec 2019 10:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575570918; cv=none; d=google.com; s=arc-20160816; b=0Hk8mO9zFJg7g1H3QM5D41g/+0vk9Ntzh0+kxbk2PQNTv6MZicD5ht3YvWm8N0Cmf/ srHuMjG3ffG0jHsdzpeABMv2uSXY/51Z/u1MI+LwRpKmaBVi8QmeywAV/7uV4mqXR2X4 xGS06K5fXG4RjhgbKmPx+h0lyyV9RSSrsTgHlfkszFDdKX3yCMM8WHkyXBAhEANxjzCd 9CseIg4gKx9QO9+qE2k9/4Ii1zbVPb5pyt+qwwfLNQbj+3Ey9Yk5gs57IGJ5fIYNWQ0I sA4/hzSQlB3fBgbQ5aQwIFRvTj1KMilGRLPlGK8lcVGNL7YxsOu9hNVx8KKkZeWzF9hp ujMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=plT90yHYMq9KJhSKgfBtVdIcr2ScTS8n0bGEHINWPbA=; b=kcleCdds3YoGYRZxXvGEnbqA9ZE0W1JEwfjLvsPktHIB+RLP0uF5L8wD0kNClH/Qq3 Hxi4n4fSCdxrQ3vTXDk8xJa+6iUQATDa+5Dt3GWGrQRsdBolga9Emvl5qzDjc/XdLWlR lSagQ3v6eff2THhZWiOEB5up4OC5W+Ayq3TJY+zzoHH8DEr8FmeBVvyXrQBcqgTbp4Om gTdVILlniBVaXZe2yX4CqgHJl1kJ3NWQPTw/DNNHAH1iCzCoZ6fWTV/PqY35XRcMT+uF /1KVHInSxrtiDUQ6D0eOHfvR0mo3VwmFlIAh585x1GtuGv5TyOL/8CDSiSfkbgNYFw2w qrqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UpsDOL+a; dkim=pass header.i=@linaro.org header.s=google header.b=QM1IPwMt; spf=pass (google.com: domain of libc-alpha-return-107757-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107757-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q65si5186128oic.78.2019.12.05.10.35.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2019 10:35:18 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-107757-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UpsDOL+a; dkim=pass header.i=@linaro.org header.s=google header.b=QM1IPwMt; spf=pass (google.com: domain of libc-alpha-return-107757-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107757-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Il3rfi2b4Xo+E+P9WaPC/29CVLlTGE5 OQKRDH08kOk1jG7M4wDL7uxGwjWqgMyAdL06kn72CHt8AvdfkIfpk2umQORVCtQZ dkvi9/Dgu4aVdVDoQemIwItIs+11zM9NIWfya0OZw2lAyHmNv3ZLkHTFmGF/PC4+ UBJfBK1K31nI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Vi8sGO3gUYsVqWi9ZRsGn10mTIQ=; b=UpsDO L+ayMU54VrZaA07tcQY8Th9YCMrSquOfJyw9V9jkSvqCg14KZ6CicNjqaXR9FT97 6hSyGAgWhyJHTUvO9MaYHSnPVKeUtibwOBroVfgcukDyPrfSHrI40xOufuHRAH6y 9m4/SzYQNh2uUHMtPD74n1WJ3VS6jFw1O3ibXw= Received: (qmail 60490 invoked by alias); 5 Dec 2019 18:34:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 60451 invoked by uid 89); 5 Dec 2019 18:34:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:sk:mail-vs, H*MI:sk:dff9adb, H*RU:sk:mail-vs, HX-Spam-Relays-External:sk:mail-vs X-HELO: mail-vs1-f44.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=plT90yHYMq9KJhSKgfBtVdIcr2ScTS8n0bGEHINWPbA=; b=QM1IPwMt7V+bLl3NsW1TXDOZDSjVlgmdmoLWnv7AGmr5rYOwEm7TvxQlazcoIXnBCy 0PHfPlvlL5V0gJhGGTu8hQomMWFOKMIfD+5mji9+S7fDwUlbVPQjv1STKb8C0nXj8NZ9 ytrfNy006DwPWn+fMu91GEMfN8A0kLop4+qSHoRDBVW99/jDNMFNfULFnX/Nwj6X72w7 I788qeJJUwZx9tD0wbZn4KKBTyNO4EPwCoJQtoDgfccMeFf25Q3aD1JUntMuiRMdEN5d EYdUXb4PhfLAt4COo4YlWRfeNzFz2lmyfaQ9VhIJ35IK1aCLZEk4iVwsavZjxEsSViEb emFQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 1/3] linux: Consolidate sigprocmask Date: Thu, 5 Dec 2019 15:34:35 -0300 Message-Id: <20191205183437.22696-1-adhemerval.zanella@linaro.org> In-Reply-To: References: All architectures now uses the Linux generic implementation which uses __NR_rt_sigprocmask. Checked on x86_64-linux-gnu, sparc64-linux-gnu, ia64-linux-gnu, s390x-linux-gnu, and alpha-linux-gnu. --- sysdeps/unix/sysv/linux/alpha/sigprocmask.c | 58 ------------------- sysdeps/unix/sysv/linux/ia64/sigprocmask.c | 40 ------------- .../sysv/linux/s390/s390-64/sigprocmask.c | 38 ------------ sysdeps/unix/sysv/linux/sigprocmask.c | 14 +---- .../sysv/linux/sparc/sparc64/sigprocmask.c | 34 ----------- sysdeps/unix/sysv/linux/x86_64/sigprocmask.c | 39 ------------- 6 files changed, 3 insertions(+), 220 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/sigprocmask.c delete mode 100644 sysdeps/unix/sysv/linux/ia64/sigprocmask.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c delete mode 100644 sysdeps/unix/sysv/linux/x86_64/sigprocmask.c -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/alpha/sigprocmask.c b/sysdeps/unix/sysv/linux/alpha/sigprocmask.c deleted file mode 100644 index 0e807179bf..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/sigprocmask.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 1993-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Mosberger (davidm@azstarnet.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include - -/* When there is kernel support for more than 64 signals, we'll have to - switch to a new system call convention here. */ - -int -__sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - unsigned long int setval; - long result; - - if (set) - setval = set->__val[0]; - else - { - setval = 0; - how = SIG_BLOCK; /* ensure blocked mask doesn't get changed */ - } - - result = INLINE_SYSCALL (osf_sigprocmask, 2, how, setval); - if (result == -1) - /* If there are ever more than 63 signals, we need to recode this - in assembler since we wouldn't be able to distinguish a mask of - all 1s from -1, but for now, we're doing just fine... */ - return result; - - if (oset) - { - oset->__val[0] = result; - result = _SIGSET_NWORDS; - while (--result > 0) - oset->__val[result] = 0; - } - return 0; -} - -libc_hidden_def (__sigprocmask) -weak_alias (__sigprocmask, sigprocmask); diff --git a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c b/sysdeps/unix/sysv/linux/ia64/sigprocmask.c deleted file mode 100644 index 81c2d3cd8e..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1997-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Linux/IA64 specific sigprocmask - Written by Jes Sorensen, , April 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Linux/ia64 only has rt signals, thus we do not even want to try falling - back to the old style signals as the default Linux handler does. */ - -#include -#include -#include - -#include -#include - -/* Get and/or change the set of blocked signals. */ -int -__sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); -} -libc_hidden_def (__sigprocmask) -weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c deleted file mode 100644 index f0eb099748..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2001-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try - falling back to the old style signals as the default Linux handler does. */ - -#include -#include -#include - -#include -#include - -/* Get and/or change the set of blocked signals. */ -int -__sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); -} -libc_hidden_def (__sigprocmask) -weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c index 01521c8107..73b0d0c19a 100644 --- a/sysdeps/unix/sysv/linux/sigprocmask.c +++ b/sysdeps/unix/sysv/linux/sigprocmask.c @@ -15,17 +15,9 @@ License along with the GNU C Library; if not, see . */ -#include #include -#include /* Needed for string function builtin redirection. */ -#include - -#include -#include - #include /* SIGCANCEL, SIGSETXID */ - /* Get and/or change the set of blocked signals. */ int __sigprocmask (int how, const sigset_t *set, sigset_t *oset) @@ -35,8 +27,8 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset) /* The only thing we have to make sure here is that SIGCANCEL and SIGSETXID are not blocked. */ if (set != NULL - && (__builtin_expect (__sigismember (set, SIGCANCEL), 0) - || __builtin_expect (__sigismember (set, SIGSETXID), 0))) + && __glibc_unlikely (__sigismember (set, SIGCANCEL) + || __glibc_unlikely (__sigismember (set, SIGSETXID)))) { local_newmask = *set; __sigdelset (&local_newmask, SIGCANCEL); @@ -44,7 +36,7 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset) set = &local_newmask; } - return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); + return INLINE_SYSCALL_CALL (rt_sigprocmask, how, set, oset, _NSIG / 8); } libc_hidden_def (__sigprocmask) weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c deleted file mode 100644 index 5823826ab2..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1997-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include - -#include -#include - -/* Get and/or change the set of blocked signals. */ -int -__sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); -} -libc_hidden_def (__sigprocmask) -weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c deleted file mode 100644 index c2e721d7b9..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1997-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Jes Sorensen, , April 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Linux/x86_64 only has rt signals, thus we do not even want to try falling - back to the old style signals as the default Linux handler does. */ - -#include -#include -#include - -#include -#include - -/* Get and/or change the set of blocked signals. */ -int -__sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); -} -libc_hidden_def (__sigprocmask) -weak_alias (__sigprocmask, sigprocmask) From patchwork Thu Dec 5 18:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 180901 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2343342ile; Thu, 5 Dec 2019 10:34:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyI38+fGi51yURANX2fajMYlxWcz8ZeL/9h0owxpdZ/iV7NAgSF6MTCqndpdSNGE86skHJN X-Received: by 2002:aca:ac88:: with SMTP id v130mr8084005oie.123.1575570898510; Thu, 05 Dec 2019 10:34:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575570898; cv=none; d=google.com; s=arc-20160816; b=ykH7ds7BrF2v+YFDnifQJx9B7c5p4grjVtpwqq+7F4MzaKrOeWn7z10GAWdkYLtieM CnqMrgn3F4AmR//dJvydk6cT7MD065Mumq/0doiKo6rybZ3OIGE+7LiDmHzxHQd6qUOO ciQHjcgwshDyxDeDF4FWZVAjW7B0N7fGqhnsHpJgWeoMItgYV+sJ2f+5E9hbhAKCdBtE V48KiXWaW6+dtMw1sIOISSw4chHL3u0dM9rgXlYqiCQ0wpwcFneOhf1CQT5IdBlyftUH uxdMs1Q7ILNCniIyxzvTyoHO7W5HYIm1nxj9XnFAWicDxD0zkbMGEFef288U7BoavW+B 6a5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Y4b4cd51VUxLBRlxTfEpD8Zg7+nIrQih252Za/Tdm78=; b=OimEbbcUDntF99YDSdiwfsMZcmm7NDLsiLTa/d5ROn5zPs6R9/M4FzettAHIosevQu CBBHsJ7Mu9PGMIpXvxK1wKqR/t9ZyrI7hkR1Zlsswea/bCKGqTBcnA7Sg01ExUoGIBvP eTBppuBYJVtNW9D9a3q+8P5BfVMpYgTk1G+ZFmuouctavuzfHKasRPLq5CNFmibuOH6h 7C31X3yoZhG7Y9oHJexJM1anOLnoGdHmYiPp1r8rrreBSg5fMjf7BwAP5FYrVIswyahX WLxRtXcJXlwtr5liW1jO6hmrcngaminX1uczv/FKymaZKkQm62IldU3nB4YlOLg434U0 kxPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fH58Wzbt; dkim=pass header.i=@linaro.org header.s=google header.b=qq48xbjX; spf=pass (google.com: domain of libc-alpha-return-107756-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107756-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z18si5526654oti.306.2019.12.05.10.34.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2019 10:34:58 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-107756-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fH58Wzbt; dkim=pass header.i=@linaro.org header.s=google header.b=qq48xbjX; spf=pass (google.com: domain of libc-alpha-return-107756-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107756-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=W3LeGLst55VM7o9k9yeM9rZ+OWDQGtG A38Kvbu1J/+gddmMgSsIK3sGuNpzYWSrPHiyaGMY85a1lJP3s+eqZSiPxUO2ZD/Q zSCWVgr0K4LuH9lMEOgsWewXyIn2G49RjGVc4qdPh56l4U/HHfet63DFu/hyv7/O seoQDgaBX080= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=EkcvdyCkGY4Jn+7/X4wtjWzBjvU=; b=fH58W zbtdk7OrH9VSQKfhq+wccasnO95MQWNdgJcyqoD5+9uhkJSLB/ZdmMUxhQUUCJAX tJ3nq7uRrCHOYqFUb6yo425Al2SIVLNdmTiljYaD3EsfUyNT5tQhpGdFerkrROHU LVyyF+TWzk843crlGn/V9PrZDbwipVZWX0p8OI= Received: (qmail 60474 invoked by alias); 5 Dec 2019 18:34:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 60450 invoked by uid 89); 5 Dec 2019 18:34:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:sk:dff9adb, H*f:sk:dff9adb X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Y4b4cd51VUxLBRlxTfEpD8Zg7+nIrQih252Za/Tdm78=; b=qq48xbjXvBAc0/iLiqVZxeVPPQtUdgI0rXz9E6z5MPoX/QxyDyikBRqqzBHuYRLiLO Ox9I7ZbZwim1qY01Vwt3WhWrUQcsQRLR85T4UtltN6vHymd34rPiVK0IfAgKsiiy/wtD FnOzMtaFvtfd8KqoaZ1KC8gFJMCTTAi3zRd/uEwbtPKYjrStK600YCkdNjENuw0r1fBv 6IUL0ZzeVRTqAEV7Yk2hP609nRoX88C0IJFfuoNTkCGkzo6SgBUSgDPxfRa5EZbTbgYb z4gD59lmwOoxFD/Plfji02wOMqVEp+1lWmBLCkczxyDPlNvJ1ofsChzf4n285phHf8QP tbwg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 2/3] linux: Remove SIGCANCEL/SIGSETXID handling on sigprocmask Date: Thu, 5 Dec 2019 15:34:36 -0300 Message-Id: <20191205183437.22696-2-adhemerval.zanella@linaro.org> In-Reply-To: <20191205183437.22696-1-adhemerval.zanella@linaro.org> References: <20191205183437.22696-1-adhemerval.zanella@linaro.org> The sigfillset already does it, and this is the canonical way to operate on sigset_t. The only way to actually broke this assumption is if caller initialize sigset with memset or something similar, i.e, bypassing glibc (and again this is not a valid construction). Checked on x86_64-linux-gnu. --- sysdeps/unix/sysv/linux/sigprocmask.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c index 73b0d0c19a..c6961a8ac4 100644 --- a/sysdeps/unix/sysv/linux/sigprocmask.c +++ b/sysdeps/unix/sysv/linux/sigprocmask.c @@ -16,26 +16,12 @@ . */ #include -#include /* SIGCANCEL, SIGSETXID */ +#include /* Get and/or change the set of blocked signals. */ int __sigprocmask (int how, const sigset_t *set, sigset_t *oset) { - sigset_t local_newmask; - - /* The only thing we have to make sure here is that SIGCANCEL and - SIGSETXID are not blocked. */ - if (set != NULL - && __glibc_unlikely (__sigismember (set, SIGCANCEL) - || __glibc_unlikely (__sigismember (set, SIGSETXID)))) - { - local_newmask = *set; - __sigdelset (&local_newmask, SIGCANCEL); - __sigdelset (&local_newmask, SIGSETXID); - set = &local_newmask; - } - return INLINE_SYSCALL_CALL (rt_sigprocmask, how, set, oset, _NSIG / 8); } libc_hidden_def (__sigprocmask) From patchwork Thu Dec 5 18:34:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 180903 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2343863ile; Thu, 5 Dec 2019 10:35:26 -0800 (PST) X-Google-Smtp-Source: APXvYqz6g1CyouSf6n7z6UwGO4sq3UsYoOfaBSZ/+gddob74Q5Cu+dOBCdHtjh8b4dClOf5ht55i X-Received: by 2002:a05:6808:8d5:: with SMTP id k21mr8786933oij.121.1575570926819; Thu, 05 Dec 2019 10:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575570926; cv=none; d=google.com; s=arc-20160816; b=zu8R8IcJRrQlkmd5wzoTgl8JVrCJfZzYQNW80NfJb1OrdF95vi13AHDqZ41Fz/AFjD aJY8aq9+dpwFL5LGYam4NoryR4jQ29UDCdWxzpL0JXvwErfPxKSME2fdCIYJ6N2yGcsF gW9eeq5se1YkDUew1vF3Tm3LvkUjRqEQ2Ud1lsVgX7uHaeDrEew1q0lOTT6YHdU4NYrr Fo9N/r7QOg190XiGay6+zsTSm/txfqAqBhwff7FyPHrHYfhiwDSSsSr0PXVe0TOD+X0b ji1EFIu1P5TzpwQweRYqS8T/AbjWkFHEtytdSko/x8ixR4IwWXQV1jEsfeGDUYQq7AJb CzvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=DVUxp5bgMUoOw2DPjJDOjO2OGU+DHE/E00Y6OiPYYVg=; b=LwsOqcylNirHtLJFpTlT6F6tGQzFVnESFJvWQ8i2UCpV0jFjWLLlXh6ySLaKTMbXEd QlbgAdOeWWt/mdypD+uHUv4n8pui2k9U4VHB/Kb9eZMOTuwDajuPbA4BTzfPV31vQN7T Y1Hf04l3S1vj4LlK8Qifjak/ylBt2260SZd/3HqxVWWg5xKpPK+9yuDf5Cd8pzpOrd+7 8yMPIfVndLHiDkcTmk1te6OBGeDPRqMkfs93B25KQx2TJkgzedQKmDg7H0bj9WNS6S9L 6nI4ZhvNk/o7r9KKz6RSXHDW2LOmwJPid30dVK3neaVtt+UVCwQSXqHoGbuzhO9L6n87 X2Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=IhkeipY7; dkim=pass header.i=@linaro.org header.s=google header.b=hDFRUB1s; spf=pass (google.com: domain of libc-alpha-return-107758-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107758-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z13si5781188oti.272.2019.12.05.10.35.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2019 10:35:26 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-107758-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=IhkeipY7; dkim=pass header.i=@linaro.org header.s=google header.b=hDFRUB1s; spf=pass (google.com: domain of libc-alpha-return-107758-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107758-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=D9DI8+ksN7tauPosMJ1mWGzm7id1ofk S2V2DVNWkP1D//Fvk3VvGAY1IE1H4ZFqueYtFfE7P2b63tWBvXHlwA6Ysw+0RInS 8kOQOGlsPNeHtoH6tNWN6DxD8LB+eukAa4hHRVTJndb1JBqLXvfSEeXZWY7/ia0k cAEVX5AC+G9E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=r+mgglWSLSFed2vu8AdB2hPxt90=; b=Ihkei pY7CIH+Eya0jNSDr5AkaTi7ed2w5F5DW7EtXY9R99uGuY3FiNXc7L7iOQPV15AeL Wm4yAkIP20sYXJuUIBeQQZdC/NQ4cLquip4YDkXWkTKRp7Ow0cWRci7zXIIoKdSL U+rRMLAHUAYa7a2vjMZaG933HslLQH7P+uWLko= Received: (qmail 60749 invoked by alias); 5 Dec 2019 18:34:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 60575 invoked by uid 89); 5 Dec 2019 18:34:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:a67 X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=DVUxp5bgMUoOw2DPjJDOjO2OGU+DHE/E00Y6OiPYYVg=; b=hDFRUB1sPoNHdqfxljB3/J1/k9B3gvEQCVgJ3E0K4ihDrtVHRnT6CteTFKwI77pmiF AbhIDClL79MHRaaMckelBBPi2P0fdtyfTvIkgE5jH6ZDxfUd7RZ4J1IHT4KzZN2pcI4F dXTQN5dwmDdEfFG0y0Yl8bMggfB21yki2mreCwtd9LqSq1amRI3zJkXQywC1EIXb9QoB p3Kj8jCZ4DtZQD+Pp1z4KiAQhkPPYP06O3LdDOjojluJuo8PxLGJpTTczPjA+ltnY9Xa BM4uZN+ZM1NV2J3LrlsQHWqRnxkDXPSpJjvwq4ULB8F5J+sOduOdXq/I/iyXQO6OD+Wx 02Ew== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 3/3] Fix __libc_signal_block_all on sparc64 Date: Thu, 5 Dec 2019 15:34:37 -0300 Message-Id: <20191205183437.22696-3-adhemerval.zanella@linaro.org> In-Reply-To: <20191205183437.22696-1-adhemerval.zanella@linaro.org> References: <20191205183437.22696-1-adhemerval.zanella@linaro.org> The a2e8aa0d9e shows two regressions on sparc64-linux-gnu: nptl/tst-cancel-self-canceltype nptl/tst-cancel5 This is not from the patch itself, but rather from an invalid __NR_rt_sigprocmask issued by the loader: rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(0xffd07c60 /* SIG_??? */, ~[], 0x7feffd07d08, 8) = -1 EINVAL (Invalid argument) Tracking the culprit it really seems a wrong code generation in the INTERNAL_SYSCALL due the automatic sigset_t used on __libc_signal_block_all: return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &SIGALL_SET, set, _NSIG / 8); Where SIGALL_SET is defined as: ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }) Building the expanded __libc_signal_block_all on sparc64 with recent compiler (gcc 8.3.1 and 9.1.1): #include int _libc_signal_block_all (sigset_t *set) { INTERNAL_SYSCALL_DECL (err); return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &SIGALL_SET, set, _NSIG / 8); } It seems that the first argument (SIG_BLOCK) is not correctly set on 'o0' register: __libc_signal_block_all: save %sp, -304, %sp add %fp, 1919, %o0 mov 128, %o2 sethi %hi(.LC0), %o1 call memcpy, 0 or %o1, %lo(.LC0), %o1 add %fp, 1919, %o1 mov %i0, %o2 mov 8, %o3 mov 103, %g1 ta 0x6d; bcc,pt %xcc, 1f mov 0, %g1 sub %g0, %o0, %o0 mov 1, %g1 1: sra %o0, 0, %i0 return %i7+8 nop Where is I define SIGALL_SET outside INTERNAL_SYSCALL macro, gcc correctly sets the expected kernel argument in correct register: sethi %hi(.LC0), %o1 call memcpy, 0 or %o1, %lo(.LC0), %o1 -> mov 1, %o0 add %fp, 1919, %o1 This patch fixes it by moving both sigset_t that represent all signals sets and the application set to constant data objects. This patch also changes the return value of __libc_signal_block_all, __libc_signal_block_app, and __libc_signal_restore_set to 'void' since the function should not fail if input argument is NULL. Also, for Linux the return value is not fully correct on some platforms due the missing usage of INTERNAL_SYSCALL_ERROR_P / INTERNAL_SYSCALL_ERRNO macros. Checked on x86_64-linux-gnu, i686-linux-gnu, and sparc64-linux-gnu. --- sysdeps/unix/sysv/linux/internal-signals.h | 37 ++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h index 01d8bf0a4c..ae2d626ef0 100644 --- a/sysdeps/unix/sysv/linux/internal-signals.h +++ b/sysdeps/unix/sysv/linux/internal-signals.h @@ -53,36 +53,47 @@ __clear_internal_signals (sigset_t *set) __sigdelset (set, SIGSETXID); } -#define SIGALL_SET \ - ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }) +static const sigset_t sigall_set = { + .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } +}; + +static const sigset_t sigapp_set = { +#if ULONG_MAX == 0xffffffff + .__val = { [0] = ~0UL & ~(__sigmask (SIGCANCEL)), + [1] = ~0UL & ~(__sigmask (SIGSETXID)), + [2 ... _SIGSET_NWORDS-1] = ~0UL } +#else + .__val = { [0] = ~0UL & ~(__sigmask (SIGCANCEL) + | __sigmask (SIGSETXID)), + [1 ... _SIGSET_NWORDS-1] = ~0UL } +#endif +}; /* Block all signals, including internal glibc ones. */ -static inline int +static inline void __libc_signal_block_all (sigset_t *set) { INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &SIGALL_SET, - set, _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigall_set, set, + _NSIG / 8); } /* Block all application signals (excluding internal glibc ones). */ -static inline int +static inline void __libc_signal_block_app (sigset_t *set) { - sigset_t allset = SIGALL_SET; - __clear_internal_signals (&allset); INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &allset, set, - _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigapp_set, set, + _NSIG / 8); } /* Restore current process signal mask. */ -static inline int +static inline void __libc_signal_restore_set (const sigset_t *set) { INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, set, NULL, - _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_SETMASK, set, NULL, + _NSIG / 8); } /* Used to communicate with signal handler. */