From patchwork Wed Sep 14 18:56:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 76230 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2023641qgf; Wed, 14 Sep 2016 11:56:43 -0700 (PDT) X-Received: by 10.98.97.7 with SMTP id v7mr7292930pfb.49.1473879403359; Wed, 14 Sep 2016 11:56:43 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id fg16si5990843pab.21.2016.09.14.11.56.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Sep 2016 11:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-73272-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; spf=pass (google.com: domain of libc-alpha-return-73272-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-73272-patch=linaro.org@sourceware.org; dmarc=fail (p=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=LpBTPFqgweytbCB1ALci7QTiaMEtXCf gt18kGT5Hevns82yFR21yJYrw6Yg4gRU4tgVblcoU5vUrSWYs1FionO4Kc+Q/Sg1 frn4hc2TmMfiZOhDDjI5HqPIRpxUq+GzgbJgf5OvhnJaU3k1gvpqikt4df9OrmbM Mx3DqDRi45EA= 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=75tH2Sa1c/Qlh23iKB/MxKqL+TM=; b=rPtfF 5GVJRiZqlhNwMcoJI7tkeh/UK7xdKDtZgzfdmQniXnS6Z1nDbIxDXS6v/Kdj4a/p 32hjG8xpjKExEqVPT+ZrfZH0UtFc7PnzrRhC3nJxYVdQdL/849VyRRq/8aGG0Nvv /OOBECnOM5fUgU4TJPU1fvZGl6a7J9wiWmxylU= Received: (qmail 130987 invoked by alias); 14 Sep 2016 18:56:34 -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 130958 invoked by uid 89); 14 Sep 2016 18:56:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=unblock, CLONE X-HELO: mail-yw0-f174.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=luimVgZzyFPUJ4hnGYcHGOzBhM5QlFemJ7G5A1mJlOo=; b=BUNRzi4xieTVGehJ6AxVHw5drbY2Q1Lh4Mee8li+cghIFB7wnd0IwXe7ZVHIDqX1Pt A6/NKg7UaIZNaJKNngfZzPQJekBDXvVJoQYGttPkXO4IJJ2nJOcsMBz36KYGv5PFZpeP xq+Y1G+mdUDSozgp9dIkJ8LNLLs59b80Sjb5Xo/TOghPXR9ppYCZP1KKTPngJaHJAbMK y3CvKeeeY3OiuDELiwHymR5fdhi1FIUWnLqk9KlxUkcYcpDCw0RUESdMMnJby9SZyLda 4NUR1DnPEszuLIOJv/EDMJUOiISKN49+npxLERlljUAPTL9T2VnuEl4ONxRXXjmbPU+O UvrQ== X-Gm-Message-State: AE9vXwNwcroJsD9+ybTTV0BUBmo6+4bdQqdexMZ+2b2IMvSF+3iaVMSxjjSz5DVbKS96ZZa7 X-Received: by 10.129.45.194 with SMTP id t185mr4860624ywt.220.1473879382823; Wed, 14 Sep 2016 11:56:22 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/2] posix: Correctly block/unblock all signals on Linux posix_spawn Date: Wed, 14 Sep 2016 15:56:10 -0300 Message-Id: <1473879370-6731-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1473879370-6731-1-git-send-email-adhemerval.zanella@linaro.org> References: <1473879370-6731-1-git-send-email-adhemerval.zanella@linaro.org> This patch correctly block and unblocks all signals when executing Linux posix_spawn by using the __libc_signal_{un}block_all functions instead of default sigprocmask. The latter might remove both SIGCANCEL and SIGSETXID from the blocked signal list. Checked on x86_64, i686, powerpc64le, and aarch64. * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock all signals when executing the clone vfork child. (SIGALL_SET): Remove macro. --- ChangeLog | 4 ++++ sysdeps/unix/sysv/linux/spawni.c | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index f7cb96f..c34f8fd 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -60,10 +60,6 @@ normal program exit with the exit code 127. */ #define SPAWN_ERROR 127 -/* We need to block both SIGCANCEL and SIGSETXID. */ -#define SIGALL_SET \ - ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }) - #ifdef __ia64__ # define CLONE(__fn, __stack, __stacksize, __flags, __args) \ __clone2 (__fn, __stack, __stacksize, __flags, __args, 0, 0, 0) @@ -331,7 +327,7 @@ __spawnix (pid_t * pid, const char *file, args.xflags = xflags; args.err = 0; - __sigprocmask (SIG_BLOCK, &SIGALL_SET, &args.oldmask); + __libc_signal_block_all (&args.oldmask); /* The clone flags used will create a new child that will run in the same memory space (CLONE_VM) and the execution of calling thread will be @@ -357,7 +353,7 @@ __spawnix (pid_t * pid, const char *file, if ((ec == 0) && (pid != NULL)) *pid = new_pid; - __sigprocmask (SIG_SETMASK, &args.oldmask, 0); + __libc_signal_restore_set (&args.oldmask); __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);