From patchwork Fri Jun 23 08:18:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 21224 Received: (qmail 16052 invoked by alias); 23 Jun 2017 08:18:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15912 invoked by uid 89); 23 Jun 2017 08:18:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=andr, Andr, Andr=c3=a9, andr=c3=a9?= X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Jun 2017 08:18:10 +0000 Received: by mail-wr0-f169.google.com with SMTP id 77so55163955wrb.1 for ; Fri, 23 Jun 2017 01:18:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=w8F62y4M9AaTYRoXmQOSRxjXV4gG8pvZCVY7ojap2v4=; b=TRN+xYUfWtudrd0T60Tg11UhqdwkYCb4JyJyjqJMba0Q7RcTRVOyZj4XHxLNinNIW+ QtnKNjtwx6iUKQYJE3TbGonwAgCc9p6+/9WN/LGIi6Xrd+h7wCNMKhoP5WaPNFLb/VJR z24PHeFHVuWhQkJuDy9tXKOaitBhVpKwIL/gk0BQMRcITjg68aFFB09gczdmMIjq7bTg ij0mqOIHUMEyHesOg/+ikMunaB9ni2kGBp6BwF+iJhSfVbpXwgF1LJYxHfaaF8pQCiy7 W/vCUM0QCdKlmlRXS5Ejbiy0qsJxDhyv6ZQ+bIxFdDxlvJG3JrPaNpO/IaPac1bbLZC0 2s5A== X-Gm-Message-State: AKS2vOwniwnLyOsTCyoTBY3/K/kz+nrnh+A7Tm8S5BQumcp4Jj9DoNce m6OjM0qBql2Ov9I7WCA= X-Received: by 10.80.172.134 with SMTP id x6mr5296666edc.2.1498205887788; Fri, 23 Jun 2017 01:18:07 -0700 (PDT) Received: from tfsielt31850.garage.tyco.com ([77.107.218.170]) by smtp.gmail.com with ESMTPSA id i42sm2249239ede.5.2017.06.23.01.18.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jun 2017 01:18:06 -0700 (PDT) From: =?UTF-8?q?Andr=C3=A9=20Draszik?= To: gdb-patches@sourceware.org Subject: [PATCH] Fix PR/21658: gdbserver doesn't start on some libcs Date: Fri, 23 Jun 2017 09:18:05 +0100 Message-Id: <20170623081805.16105-1-git@andred.net> MIME-Version: 1.0 From: André Draszik gdbserver currently fails to start on musl-libc based systems with 'sigprocmask: Invalid argument' The reason is because it uses an invalid argument to sigprocmask(): http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html The argument how indicates the way in which the set is changed, and the application shall ensure it consists of one of the following values SIG_BLOCK SIG_SETMASK SIG_UNBLOCK ... The pthread_sigmask() and sigprocmask() functions shall fail if: [EINVAL] The value of the how argument is not equal to one of the defined values. This is what musl-libc implements, hence gdbserver fails to start. Fix the call to use correct arguments. gdb/ChangeLog: 2017-06-23 André Draszik PR gdb/21658 * common/signals-state-save-restore.c (save_original_signals_state): Use POSIX-compliant arguments to sigprocmask(). --- gdb/ChangeLog | 7 +++++++ gdb/common/signals-state-save-restore.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 95010fc612..ac298bc074 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2017-06-23 André Draszik + + PR gdb/21658 + * common/signals-state-save-restore.c + (save_original_signals_state): Use POSIX-compliant arguments + to sigprocmask(). + 2017-06-22 Sergio Durigan Junior * common/environ.c (gdb_environ::unset): Update comment. diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c index d11a9ae006..734335c3a2 100644 --- a/gdb/common/signals-state-save-restore.c +++ b/gdb/common/signals-state-save-restore.c @@ -41,7 +41,7 @@ save_original_signals_state (void) int i; int res; - res = sigprocmask (0, NULL, &original_signal_mask); + res = sigprocmask (SIG_BLOCK, NULL, &original_signal_mask); if (res == -1) perror_with_name (("sigprocmask"));