mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Jesse Hathaway <jesse@mbuki-mvuki.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Re: Pending patches for MT-fork stuff
Date: Tue, 29 Sep 2020 16:34:07 -0400	[thread overview]
Message-ID: <20200929203407.GH17637@brightrain.aerifal.cx> (raw)
In-Reply-To: <CANSNSoW4cg-ieujDkjTXtBfpSLd0P4tiLjzCTEZAn9b8=sYReA@mail.gmail.com>

On Tue, Sep 29, 2020 at 01:51:30PM -0500, Jesse Hathaway wrote:
> On Tue, Sep 29, 2020 at 1:36 PM Rich Felker <dalias@libc.org> wrote:
> > Can you provide an strace (with -f) showing the hang? It's probably
> > not related to this since fork does not seem to be involved. Depending
> > on how you're using Go, it may just be Go bypassing libc then trying
> > to use libc functions, which at least used to be a big problem; I
> > don't know if it's fixed nowadays or not.
> 
> Thanks Rich, for taking a look, I have attached an strace of the
> program compiled against musl & glibc. The first call to setreuid
> succeeds in both, but the second call fails under musl. Jesse

The problem is this line:

> 8238  rt_sigprocmask(SIG_SETMASK, ~[HUP INT QUIT ILL TRAP ABRT BUS FPE SEGV TERM STKFLT CHLD PROF SYS RTMIN RT_1],  <unfinished ...>

Something broken in the Go runtime is bypassing libc and either
calling SYS_rt_sigprocmask itself, or calling the libc sigprocmask
function with a sigset_t it produced itself, blocking a libc-internal
signal. This makes it invalid to make any further use of libc.

Either it (the Go runtime) needs to manipulate sigset_t objects via
the public APIs for them (sigfillset, sigaddset, etc.) or its wrapper
for sigprocmask needs to convert the Go-manipulated sigset_t to one
valid for libc by iterating over the bits and using sigaddset, so that
invalid bits don't end up in the one passed to libc.

Rich

  reply	other threads:[~2020-09-29 20:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 18:04 Jesse Hathaway
2020-09-29 18:36 ` Rich Felker
2020-09-29 18:51   ` Jesse Hathaway
2020-09-29 20:34     ` Rich Felker [this message]
2020-09-30  0:10       ` Rich Felker
2020-09-30 14:46         ` Jesse Hathaway
2020-09-30 15:55           ` Rich Felker
2021-03-03 14:40             ` Jesse Hathaway
2021-03-03 14:43               ` Rich Felker
2021-03-03 20:14                 ` Jesse Hathaway
  -- strict thread matches above, loose matches on Subject: below --
2020-09-29 17:19 Jesse Hathaway

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=20200929203407.GH17637@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=jesse@mbuki-mvuki.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).