From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 70DBF3857016 for ; Tue, 29 Jun 2021 17:03:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 70DBF3857016 Received: by mail-pg1-x534.google.com with SMTP id h4so19082947pgp.5 for ; Tue, 29 Jun 2021 10:03: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1VcnccuxjgN5wmKcU99vs60COGVEQzJ/db6EmM8UhyI=; b=YidCaDAkp2O6VwsqDmapoZLj3rchNav8uphJXLg03aD0ZGTYuvZWYrSF8hoeX02HNk Yb7GOC+qTmHDvOKqsWGLcSuasNiCsWxZaccILChZ4YS9aVNil6bD6eHzCuXqG9OhPVRH lztDU7ctXLgKruFHHJN8PEvN6RMgRj+oHsYlErE2l9lLJ3zJKySTdZeEBUeW4m4M99m5 aBRv6inBuBsKBMgpqyHHkUyacEeOlC86VXDxgY9rKv8E7iSkywNi8xyX/mxE0U3woOuX ZQm1iWSEsvDjnumlWKWvknXMVEuOybJEWj4n4mPvk0YlZGJhpjr8AIHAww0vuhgVAjwF frJA== X-Gm-Message-State: AOAM533My54VR5Fg3USAOLoKmBtYVaDpUxSEZTwVFyw/febSinEF90Zh jkdds8+2Mhtt46VaWEXkVubCrDEf4mIdWQ== X-Google-Smtp-Source: ABdhPJy9ugglc/lcRW2/yPgHdV0JPaGBypTQJaiOOVz/WYBpWAWdJtJwWl8XEMywrIja3uhV62LMYA== X-Received: by 2002:a63:2313:: with SMTP id j19mr29182739pgj.42.1624986188208; Tue, 29 Jun 2021 10:03:08 -0700 (PDT) Received: from [192.168.1.108] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id a187sm19045543pfb.66.2021.06.29.10.03.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Jun 2021 10:03:07 -0700 (PDT) Subject: Re: [PATCH 2/2] posix: Add terminal control setting support for posix_spawn To: Godmar Back Cc: libc-alpha@sourceware.org References: <20210617175751.1619846-1-adhemerval.zanella@linaro.org> <20210617175751.1619846-2-adhemerval.zanella@linaro.org> <8552a710-3ae4-8cf2-28a2-cd6dced45abf@linaro.org> From: Adhemerval Zanella Message-ID: <00bab39b-c5d9-25aa-67cf-3d8adedda8e1@linaro.org> Date: Tue, 29 Jun 2021 14:03:05 -0300 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=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2021 17:03:10 -0000 On 28/06/2021 19:17, Godmar Back wrote: > On Mon, Jun 28, 2021 at 6:03 PM Adhemerval Zanella > wrote: >> >> >> So there is no SIGTTOU being generated. I even tried to add a timeout on >> the helper process to check if the problem is the signal being generated >> asynchronously, but it is works as intended. >> > > I'm not familiar with the libc testing environment. When a process > runs in it, what is its controlling terminal? Is it part of a session? > Note that SIGTTOU is generated only if the process is part of a > session and if the terminal in question has a foreground process > group. OK, I completely forgot that we explicit block *all* signals (including internals ones) on the helper process to avoid any signal handler (I had to debug the kernel to remind it): sysdeps/unix/sysv/linux/spawni.c 130 /* The child must ensure that no signal handler are enabled because it shared 131 memory with parent, so the signal disposition must be either SIG_DFL or 132 SIG_IGN. It does by iterating over all signals and although it could 133 possibly be more optimized (by tracking which signal potentially have a 134 signal handler), it might requires system specific solutions (since the 135 sigset_t data type can be very different on different architectures). */ 136 struct sigaction sa; 137 memset (&sa, '\0', sizeof (sa)); 138 139 sigset_t hset; 140 __sigprocmask (SIG_BLOCK, 0, &hset); SO there is no need to handle SIGTTOU here and we already either set the expected mask or restore the previous defined one just before execve.