From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id N2frHlF/y2BNLwAAWB0awg (envelope-from ) for ; Thu, 17 Jun 2021 12:58:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 6FB301F163; Thu, 17 Jun 2021 12:58:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C15361E54D for ; Thu, 17 Jun 2021 12:58:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C53C398B864 for ; Thu, 17 Jun 2021 16:58:56 +0000 (GMT) Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id A3DC3398B153 for ; Thu, 17 Jun 2021 16:45:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3DC3398B153 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4384B7A44F; Thu, 17 Jun 2021 16:45:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G5Sb31CPqz3KdW; Thu, 17 Jun 2021 16:45:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id BFD8D21EE9; Thu, 17 Jun 2021 16:45:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH 0/4] Introduce scoped_ignore_signal & make it thread safe To: Pedro Alves , gdb-patches@sourceware.org References: <20210615111429.1879286-1-pedro@palves.net> <7f678d4a-b015-655f-f79a-36daccab5062@palves.net> <18c7433b-464d-b274-88a2-5495aab407ba@palves.net> From: John Baldwin Message-ID: Date: Thu, 17 Jun 2021 09:45:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <18c7433b-464d-b274-88a2-5495aab407ba@palves.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 6/17/21 8:36 AM, Pedro Alves wrote: > On 2021-06-17 3:38 p.m., Pedro Alves wrote: >> On 2021-06-15 6:04 p.m., John Baldwin wrote: > >> If SIGTTOU ends up raised by some other thread while the main thread has it blocked >> in scoped_ignore_sigttou, and if it is sent to the whole process, there's a small time window >> where the sigtimedwait in the main thread can eat the signal. That still seems better than >> the current status where the end result can be that we can end up with the signal enabled >> instead of ignored and then gdb backgrounds itself. This is of course highly theoretical since I >> expect that gdb threads run with signals blocked from the get go. But you never know what >> Python code does. >> > > Hmm, I just thought of an easy fix for that. Just don't consume the pending > signal in SIGTTOU's case. I wonder how portable is this? WDYT? > > I'll see if I can try this on Solaris. I think this is ok. I suspect that some of the rules around SIGTTOU are in POSIX as I think job control is in POSIX, so (hopefully) the behavior there is fairly uniform. I strongly suspect the other BSD's all follow FreeBSD at least, so if Solaris is the same I'd feel pretty good about this behavior being consistent. -- John Baldwin