Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pty: unblock all signals before exec'ing the child #10

Closed
wants to merge 1 commit into from

Conversation

bluetech
Copy link
Contributor

Hi,
Thanks for merging the pty stuff. This is a fix for a problem I noticed but only now had time to look at. If you can think of a more generic solution that'd be even better, of course.

Ran

When we register signals in the eloop we also block them in our signal
mask. The signal mask is inherited by the child. Therefore, if the child
does not reset its mask (e.g. bash and most normal processes), it will
not receive any of the signals that we handle. So for example C-c
(SIGINT) does nothing in the child process.

We now unblock all signals before we exec the child.

[It's also worth noting that if we _ignore_ a signal -
sigaction(SIG_IGN) - this is also inherited and we must reset it to
default. However, we do not ignore signals so this is unneeded.]

Here is some more discussion on signalfd and this problem:
https://lwn.net/Articles/415684/

Signed-off-by: Ran Benita <ran234@gmail.com>
@dvdhrm
Copy link
Owner

dvdhrm commented Jan 28, 2012

Good catch. I've applied it with sigemptyset() and SIGSETMASK as I think this is more readable. Thanks! And yes, we probably need some kind of signal subsystem later if you intend to use multiple threads and/or SIGIGN and friends. However, for now its enough what we have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants