From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by sourceware.org (Postfix) with ESMTPS id 4525F384000D for ; Tue, 15 Jun 2021 11:16:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4525F384000D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f50.google.com with SMTP id q5so17910659wrm.1 for ; Tue, 15 Jun 2021 04:16:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=labaiyULDo0vdrPX58ogXXIQ/LUcs1gwErOvwLbn/3E=; b=PeFB05Jdiorqk9dH6NiIoYUpITFynwqBNoijE09JjZQWR178e20ex1ZOW+xqSyiuYj 4mr2TXC1wwVL8GZ7p1SymTrRys/ALdW4bSOLqWav63BtGQ0qASU5yfE/YE8v9RvAMcyj Zj7NFB81mp8a3Ktp++aji6brXbYdcVlXjg0hIzRGkgj8rBvX6Iz2lCITvye2xcnxwIox E7Nd5tMJtB8dVvznYNbsZQUdJ3jjBbsCd6wCLvpuBodi4hfQwGLBGKpjbQU7TgrJAn/0 9JtqeJth1zYDoAIJrIdMSxpzDvZ4jpjEi2mZjRZyuTzIoHI+8GxDxJuvRsbFsfTVFTvK EGZQ== X-Gm-Message-State: AOAM532y+zvnVhb4HqBGBbazjRx+uXtZUM61LbMcb1YcGnlMJ7n+NZJW 76aUZYv/lrNM8KtbJF2XmgKIhb+Ga3Eufg== X-Google-Smtp-Source: ABdhPJylISYv5gSnOCl3CV7LTd84hn6CzZcwZzHhi6Hcc3ZizO5OiXB0w8AP+plx84g1aM0SHmsptw== X-Received: by 2002:a5d:6584:: with SMTP id q4mr24324054wru.230.1623755794598; Tue, 15 Jun 2021 04:16:34 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3? ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id m37sm14254086wms.46.2021.06.15.04.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 04:16:33 -0700 (PDT) Subject: Re: [PATCH] Fix gdb crash due to SIGPIPE when the compile command fails From: Pedro Alves To: Bernd Edlinger , Tom Tromey Cc: "gdb-patches@sourceware.org" References: <87tumgp1ob.fsf@tromey.com> <87zgw5oijf.fsf@tromey.com> <6256676d-b41a-02ef-22a4-e5150077c0e8@palves.net> Message-ID: Date: Tue, 15 Jun 2021 12:16:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2021 11:16:37 -0000 On 2021-06-15 6:14 a.m., Bernd Edlinger wrote: > On 6/15/21 1:35 AM, Pedro Alves wrote: >> One thing I dislike here (and also about scoped_ignore_sigttou), is that the >> signal disposition is process-wide. >> >> If we happen to have multiple threads that need to ignore the signal changing the >> disposition like that, then they may race. >> >> We can fix that by making the ignoring be per-thread instead by using >> sigprocmask + sigtimedwait. >> >> We can also introduce a generic scoped_ignore_signal so that both scoped_ignore_sigttou >> and scoped_ignore_pipe (and whatever other similar signal we may need to ignore) share >> the same code. >> >> I gave it a quick try. See the 4 patches at the top of the >> users/palves/scoped_ignore_signal branch. >> >> This was something that I've thought before about doing for SIGTTOU to be honest. >> Seeing it being copied over to SIGPIPE was simply the trigger that made me >> actually give it a try. >> >> WDYT? >> > > +1 Alright, I posted it here, now with a unit test: https://sourceware.org/pipermail/gdb-patches/2021-June/179982.html Thanks, Pedro Alves