diff options
author | 2012-02-23 09:57:13 +0100 | |
---|---|---|
committer | 2012-02-23 09:57:13 +0100 | |
commit | 5781a74a8af3057ce7b561f454e2b5b0925b1f76 (patch) | |
tree | fd9e89f35e191b048fe91ed06a2ff6c06334636a /src | |
parent | remove redundent LXC_TTY_HANDLER (diff) | |
download | lxc-5781a74a8af3057ce7b561f454e2b5b0925b1f76.tar.gz lxc-5781a74a8af3057ce7b561f454e2b5b0925b1f76.tar.bz2 lxc-5781a74a8af3057ce7b561f454e2b5b0925b1f76.zip |
correctly install signal handler for lxc-init
This patch is to correct the manipulation of signal masks when
installing signal handlers for lxc-init.
Signed-off-by: Jian Xiao <jian@linux.vnet.ibm.com>
Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lxc/lxc_init.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/lxc/lxc_init.c b/src/lxc/lxc_init.c index a534b51..2263cd1 100644 --- a/src/lxc/lxc_init.c +++ b/src/lxc/lxc_init.c @@ -95,15 +95,31 @@ int main(int argc, char *argv[]) * signal handler and to fork */ sigfillset(&mask); + sigdelset(&mask, SIGILL); + sigdelset(&mask, SIGSEGV); + sigdelset(&mask, SIGBUS); sigprocmask(SIG_SETMASK, &mask, &omask); for (i = 1; i < NSIG; i++) { struct sigaction act; + /* Exclude some signals: ILL, SEGV and BUS are likely to + * reveal a bug and we want a core. STOP and KILL cannot be + * handled anyway: they're here for documentation. + */ + if (i == SIGILL || + i == SIGSEGV || + i == SIGBUS || + i == SIGSTOP || + i == SIGKILL) + continue; + sigfillset(&act.sa_mask); - sigdelset(&mask, SIGILL); - sigdelset(&mask, SIGSEGV); - sigdelset(&mask, SIGBUS); + sigdelset(&act.sa_mask, SIGILL); + sigdelset(&act.sa_mask, SIGSEGV); + sigdelset(&act.sa_mask, SIGBUS); + sigdelset(&act.sa_mask, SIGSTOP); + sigdelset(&act.sa_mask, SIGKILL); act.sa_flags = 0; act.sa_handler = interrupt_handler; sigaction(i, &act, NULL); |