This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] nptl: Start new threads with all signals blocked [BZ #25098]
- From: Christian Brauner <christian dot brauner at ubuntu dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 15 Oct 2019 14:03:51 +0200
- Subject: Re: [PATCH] nptl: Start new threads with all signals blocked [BZ #25098]
- References: <firstname.lastname@example.org> <20191014133231.sa4zalwbsiybpyvj@wittgenstein> <email@example.com>
On Tue, Oct 15, 2019 at 01:58:53PM +0200, Florian Weimer wrote:
> * Christian Brauner:
> > On Mon, Oct 14, 2019 at 02:33:43PM +0200, Florian Weimer wrote:
> >> New threads inherit the signal mask from the current thread. This
> >> means that signal handlers can run on the newly created thread
> >> immediately after the kernel has created the userspace thread, even
> >> before glibc has initialized the TCB. Consequently, new threads can
> >> observe uninitialized ctype data, among other things.
> >> To address this, block all signals before starting the thread, and
> >> pass the original signal mask to the start routine wrapper. On the
> >> new thread, first perform all thread initialization, and then unblock
> >> signals.
> >> The cost of doing this is two rt_sigprocmask system calls on the old
> >> thread, and one rt_sigprocmask system call on the new thread. (If
> >> there was a way to clone a new thread with a signals disabled, this
> > He, do I see a growing wishlist? :)
> Maybe. I think the handler reset is more important because as
> Adhemerval explained, it saves many more system calls.
Right. If you feel comfortable reviewing it an Ack from you on the
kernel patch would be good.