From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by sourceware.org (Postfix) with ESMTPS id 8BB383857815 for ; Mon, 2 May 2022 20:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8BB383857815 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-e2442907a1so15312014fac.8 for ; Mon, 02 May 2022 13:02:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=qODy4Uq9Cmi3SmE8nlWtHBV90D3BjtlG3yOilxfkE4M=; b=Ex94SXABXvXdqM7quW+Vwd9hf5usktRFklpJz6sWuaIWfZDjL1n0DTQmp+/kTE6E/s bjqb3Fa2aZIZMM8IxYXXkF8uKGjlgHCLvgMKnE6uGuIyB3Nwqy+StesYszYARCyJ2j0w wURILIZiiOyzT/2rH1vDAFWgKMU0xzj9XVYzsCIikpmaIraZHFaoHrFf5k2wfkHYJQeK b6ZV9aULJdh3RhUnOuGBMVgx6Uu0gCavkFq78C9WPPWWxU1WXyY5K7N7IICw+/Q0UL6h vvRrtUKghKCLEcEVVNvWJGqfMoxNZMUaGPaoWJs05th05Fmw3w8h98kYEpS8jAEgrKIb lUOQ== X-Gm-Message-State: AOAM53047TrhYUqCcxefvRBbMJC95FXzGnI5JE+8H1Oye+USinWn9auh 4LY+l+2LeXgaFKGhDNMUyup14Vb3ljUZ0w== X-Google-Smtp-Source: ABdhPJyOQTgjnQKDN52syfhRhWjRsL8sNq885vBYwu9oWzpV0/Q9TsQXnHHl+gVsJ/d1NQINSIduhQ== X-Received: by 2002:a05:6870:a1a4:b0:ec:44b0:87fc with SMTP id a36-20020a056870a1a400b000ec44b087fcmr366660oaf.237.1651521765902; Mon, 02 May 2022 13:02:45 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:726:60d4:f990:5a9a:e5b1? ([2804:431:c7cb:726:60d4:f990:5a9a:e5b1]) by smtp.gmail.com with ESMTPSA id w3-20020a056830280300b006060322123dsm3142913otu.13.2022.05.02.13.02.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 13:02:45 -0700 (PDT) Message-ID: Date: Mon, 2 May 2022 17:02:43 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] linux: Fallback to fork and exec for clone fail on posix_spawn (BZ#29115) Content-Language: en-US To: Alexey Izbyshev Cc: Florian Weimer , libc-alpha@sourceware.org References: <20220502180605.1510951-1-adhemerval.zanella@linaro.org> <8e71f54e0fdf9f73393f5ea3e529d036@ispras.ru> From: Adhemerval Zanella In-Reply-To: <8e71f54e0fdf9f73393f5ea3e529d036@ispras.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 02 May 2022 20:02:48 -0000 On 02/05/2022 16:54, Alexey Izbyshev wrote: > On 2022-05-02 22:42, Adhemerval Zanella wrote: >> On 02/05/2022 16:15, Alexey Izbyshev wrote: >>> On 2022-05-02 21:06, Adhemerval Zanella wrote: >>>> +      while (__write_nocancel (args->pipe[1], &ret, sizeof (ret)) < 0); >>> >>> If the parent is killed, write() will fail with EPIPE, so this loop will become infinite. Maybe check for EPIPE and break? >> >> We block all signals (__libc_signal_block_all), so the parent will be >> only killed >> by signals that can no be caught (SIGKILL).  Same for SIGPIPE. > > The parent can indeed only be killed by SIGKILL, or simply exit from another thread, but how exactly it dies doesn't matter. But signals are already unblocked at this point in the child, so if SIGPIPE was ignored in the parent, it's ignored now in the child and is unblocked, hence write() can fail with EPIPE. > Right, I was thinking in term of the CLONE_VFORK which is not the case. But now checking on the closefrom and the pipe file descriptor issue, it seems it would be better to have the error code communicate through a shared memory instead of a pipe.