public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29115] vfork()-based posix_spawn() has more failure modes than fork()-based one
Date: Mon, 02 May 2022 17:17:00 +0000	[thread overview]
Message-ID: <bug-29115-131-aAvwQvj5S9@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29115-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29115

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Alexey Izbyshev from comment #3)
> > It is really annoying that kernel does not allow clone (CLONE_VM |
> > CLONE_VFORK)
> > with time namespace, however I am not the implications of allowing it
> > (neither
> > if this is feasible on current kernel architecture).  
> > 
> I suspect this restriction is due to the conflict of the shared address
> space and the need to provide different VDSOs (for clock_gettime()) for
> processes in separate time namespaces, but I haven't looked closely.
> 
> > In any case, adding fork+exec fallback seems feasible, the only annoying
> > case is
> > if glibc should detect a clone transient failure (for instance due some
> > resource
> > exhaustion) from a namespace filtering. We can always retry in case of clone
> > failure, it should be really an exception and retrying will most likely
> > succeed
> > in both cases.
> 
> I think it would be great if glibc provided such a fallback. I agree that
> retrying once with fork() in case of *any* clone(CLONE_VM | CLONE_VFORK)
> failure shouldn't hurt, but it should probably also be OK to skip retry on
> ENOMEM and (paradoxically) EAGAIN because the caller has to deal with them
> in any case.

It makes sense indeed.

> 
> > Another issue is with fork+exec fallback it would require additional
> > resources to communicate the possible error code from the helper process
> > while running the prepare phase (as covered by tst-spawn3.c).
> 
> Yes, I'm aware that glibc currently relies on address space sharing to pass
> the error code, so adding an alternative error reporting would constitute
> most of the fix.
> 
> One benefit of the alternative error reporting is that it would also work
> correctly in environments where vfork() system call acts as fork() (i.e.
> doesn't provide address space sharing), such as qemu-user. So if it's in
> place, glibc could add some knob to always enable it for users that need
> good posix_spawn() error reporting in such environments.

We discussed this before and we moved to use shared memory to report errors
exactly to avoid requiring another resource allocation (which adds even more
failure paths).  I am not very found in restoring it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-05-02 17:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 12:08 [Bug libc/29115] New: " izbyshev at ispras dot ru
2022-05-02 12:09 ` [Bug libc/29115] " izbyshev at ispras dot ru
2022-05-02 16:17 ` adhemerval.zanella at linaro dot org
2022-05-02 16:26 ` adhemerval.zanella at linaro dot org
2022-05-02 16:55 ` izbyshev at ispras dot ru
2022-05-02 17:17 ` adhemerval.zanella at linaro dot org [this message]
2022-05-02 18:04 ` adhemerval.zanella at linaro dot org
2022-05-02 20:38 ` carlos at redhat dot com
2022-05-02 20:43 ` fweimer at redhat dot com
2022-05-02 20:56 ` izbyshev at ispras dot ru
2022-05-02 21:02 ` carlos at redhat dot com
2022-05-02 21:06 ` fweimer at redhat dot com
2022-05-02 21:15 ` carlos at redhat dot com
2022-05-02 21:24 ` carlos at redhat dot com
2022-05-02 21:51 ` adhemerval.zanella at linaro dot org
2022-08-08 14:08 ` adhemerval.zanella at linaro dot org
2022-08-08 14:13 ` fweimer at redhat dot com
2022-08-08 14:15 ` fweimer at redhat dot com
2022-08-08 15:37 ` izbyshev at ispras dot ru

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=bug-29115-131-aAvwQvj5S9@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).