Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 29 Sep 2020 16:34:07 -0400
From: Rich Felker <dalias@...c.org>
To: Jesse Hathaway <jesse@...ki-mvuki.org>
Cc: musl@...ts.openwall.com
Subject: Re: Re: Pending patches for MT-fork stuff

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@...c.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.