From: "Trevor Gross" <tg@trevorgross.com>
To: <musl@lists.openwall.com>, <tg@trevorgross.com>
Cc: <linux-man@vger.kernel.org>, <libc-alpha@sourceware.org>
Subject: Re: async-signal-safety of chroot
Date: Wed, 23 Sep 2026 19:34:35 -0500 [thread overview]
Message-ID: <DLN4IBB6FV7K.WN3EVWC5FG17@trevorgross.com> (raw)
In-Reply-To: <20260923013428.GT23438@brightrain.aerifal.cx>
On Tue Sep 22, 2026 at 8:34 PM CDT, Rich Felker wrote:
>
> Also, both glibc and musl relax the restriction on only calling
> AS-safe functions in the child after a multi-threaded parent forks. In
> glibc this is sort of a best-effort thing, but in musl we went through
> a detailed process of ensuring that everything is made consistent for
> the child. The only thing that might not be consistent is dynamic
> linker state, which might make it impossible to dlopen in the child,
> but this is treated as a reportable error condition not a crash or
> deadlock or anything.
>
> The changes to lift the restrictions on the child happened in commit
> 167390f05564e0a4d3fcb4329377fd7743267560
>
> Rich
A followup question: the usual wisdom has been that `fork` must always
be followed by an `exec`, and not doing so is somewhere between
error-prone and completely unsound. Based per the commit it sounds like
there are no more deadlocks, and without the POSIX AS-safe requirement,
the soundness question goes away. Does this mean that it is now
considered correct and reasonable code to `fork` without `exec` for the
purpose of e.g. invoking a function in a separate process? Similar to
what can be done with `clone`.
Of course that case may be better served by a way to re-`exec` the same
process for clean state without relying on the exact same hacks, but
that unfortunately doesn't exist.
- Trevor
next prev parent reply other threads:[~2026-09-24 0:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 0:53 async-signal-safety of chroot tg
2026-09-23 1:34 ` [musl] " Rich Felker
2026-09-23 4:17 ` John Scott
2026-09-23 4:40 ` [musl] " Rich Felker
2026-09-23 8:38 ` Florian Weimer
2026-09-23 23:21 ` Trevor Gross
2026-09-24 0:34 ` Trevor Gross [this message]
2026-09-24 2:12 ` [musl] " Rich Felker
2026-09-24 9:21 ` Florian Weimer
2026-09-23 23:38 ` [PATCH 1/2] man/man2/chroot.2: Document that chroot is AS-safe Trevor Gross
2026-09-23 23:38 ` [PATCH 2/2] man/man2/fork.2: Document glibc and musl relaxed fork->exec AS requirements Trevor Gross
2026-09-23 23:47 ` [musl] " Rich Felker
2026-09-25 19:54 ` Florian Weimer
2026-10-02 6:50 ` Trevor Gross
2026-10-03 20:48 ` Gabriel Ravier
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=DLN4IBB6FV7K.WN3EVWC5FG17@trevorgross.com \
--to=tg@trevorgross.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=musl@lists.openwall.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.