public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Alexey Izbyshev <izbyshev@ispras.ru>
Cc: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] linux: Fallback to fork and exec for clone fail on posix_spawn (BZ#29115)
Date: Mon, 2 May 2022 17:09:26 -0300	[thread overview]
Message-ID: <fce54391-e1e4-9d63-f321-52d38521aefd@linaro.org> (raw)
In-Reply-To: <82bff9fea1613234a0095e4d26f4d5ff@ispras.ru>



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.

  reply	other threads:[~2022-05-02 20:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 18:06 Adhemerval Zanella
2022-05-02 19:15 ` Alexey Izbyshev
2022-05-02 19:30   ` Florian Weimer
2022-05-02 19:37     ` Alexey Izbyshev
2022-05-02 20:05       ` Florian Weimer
2022-05-02 19:42   ` Adhemerval Zanella
2022-05-02 19:54     ` Alexey Izbyshev
2022-05-02 20:02       ` Adhemerval Zanella
2022-05-02 20:08         ` Alexey Izbyshev
2022-05-02 20:09           ` Adhemerval Zanella [this message]
2022-05-02 19:57     ` Adhemerval Zanella
2022-05-02 20:02       ` Alexey Izbyshev
2022-05-02 20:04         ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fce54391-e1e4-9d63-f321-52d38521aefd@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=izbyshev@ispras.ru \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).