This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING] pt_chown: Clear any signal mask inherited from the parent process.
- From: Siddhesh Poyarekar <sid at reserved-bit dot com>
- To: Geoffrey Thomas <geofft at ldpreload dot com>, libc-alpha at sourceware dot org
- Date: Sat, 3 Oct 2015 15:22:02 +0530
- Subject: Re: [PING] pt_chown: Clear any signal mask inherited from the parent process.
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1505250942320 dot 13977 at cactuar dot ldpreload dot com>
On Monday 25 May 2015 07:22 PM, Geoffrey Thomas wrote:
> If grantpt() is called from a thread that is masking signals (for
> instance, from a program using signalfd or using a dedicated
> signal-handling thread), then that mask will get inherited to pt_chown.
> This means that signals like SIGINT will not interrup pt_chown, so if it
> hangs (e.g., because getgrnam("tty") hangs on a remote name service),
> Ctrl-C will terminate the parent process but leave pt_chown around. Since
> it's setuid, it's hard to kill any other way.
>
> It is safe for pt_chown to unmask all signals, because grantpt() can be
> (and usually is) called from an unprivileged process with all signals
> unmasked.
pt_chown is no longer built by default, but I'm inclined to push this in
since it only makes the behaviour more consistent. I'll commit the
patch next week if nobody objects.
Siddhesh