From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id A358F3858C50 for ; Mon, 2 May 2022 20:09:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A358F3858C50 Received: by mail-ot1-x32c.google.com with SMTP id s12-20020a0568301e0c00b00605f30530c2so6579318otr.9 for ; Mon, 02 May 2022 13:09:30 -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=2IeioeJDnqyReoREP3Bi7BdzgiLAeMwvxWWm2rvEQkI=; b=vY8JqcocB13zHwQ0nKen2R7QuSv+e/AbTq8Saf0/1o7eetwXO7bzheQ3Xe+BYnDIhR SVY9gtn+mAFNCuAQdhxUGlgEFb7dqOz3drTYeR34tm/YlBYiZqHA9ngZlllQxPC8b/yW 8LQFHZk7fsr90Q+9Dn1f4CoIc6Ts9fuAa+Gxvp7KKxTE8hkv5HOAv03KohM4gtuRxPnv +FKe6M2ym1L8Zs2fx84j7e24sIlz1JVQvisFyfhx94tncIPty6ZL0pr2J08aFDzgvecS fDroms9DDIu6ETTirIEnrzUGay6FAOmDHaWGLfSWs/5anEDKomTM/Ozizp5JaEWPVUaR kdgw== X-Gm-Message-State: AOAM533Nq9LZz3+LlrkGxSFpE+n4E+L0NdkP+OBiAP2QJKBj1oEGzJwr qsaWlozuKNdsE8KNkrsaJFYS6A== X-Google-Smtp-Source: ABdhPJwRrpMlPRDWhrr5fedev9Jo5U6bj+I6ZSQiStIAyxXCTjmPoanMJAuXZLMyca5kD2NoN3CTvA== X-Received: by 2002:a05:6830:14d4:b0:606:cc5:32cd with SMTP id t20-20020a05683014d400b006060cc532cdmr3682476otq.359.1651522169643; Mon, 02 May 2022 13:09:29 -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 v15-20020a05683018cf00b0060603221251sm3234480ote.33.2022.05.02.13.09.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 13:09:28 -0700 (PDT) Message-ID: Date: Mon, 2 May 2022 17:09:26 -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> <82bff9fea1613234a0095e4d26f4d5ff@ispras.ru> From: Adhemerval Zanella In-Reply-To: <82bff9fea1613234a0095e4d26f4d5ff@ispras.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 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:09:32 -0000 On 02/05/2022 17:08, Alexey Izbyshev wrote: > On 2022-05-02 23:02, Adhemerval Zanella wrote: >> 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. > > How do you propose to wait until the child exec's if you use shared memory? Do you plan to use clone(CLONE_VFORK) (but without CLONE_VM)? Your suggestion to use a two clone_range calls is way simpler than a shared map.