[lxc-devel] [PATCH] [RFC] lxc-init: fix odd signal mask manipulation
Greg Kurz
gkurz at fr.ibm.com
Mon Oct 17 17:29:40 UTC 2011
On Tue, 2011-10-11 at 16:18 -0700, Matt Helsley wrote:
> lxc init modifies a different signal mask in the loop than the one it's
> installing with sigaction in the loop. It appears that either these
> lines should move outside the loop, or the intent was to clear the
> bits of the sa_mask instead of the mask.
>
> Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
>
> Should the same mask bits be cleared from the mask set with
> sigprocmask prior to sigprocmask() above? (won't show up in diff
> context, sorry)
> ---
Good catch... but, honestly I wander why we even care for these signals.
The interrupt_handler() function is unlikely to trigger them and
lxc-init runs only one thread... :-\
I guess the sigdelset lines could simply be killed.
> src/lxc/lxc_init.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/lxc/lxc_init.c b/src/lxc/lxc_init.c
> index a534b51..b111494 100644
> --- a/src/lxc/lxc_init.c
> +++ b/src/lxc/lxc_init.c
> @@ -101,9 +101,9 @@ int main(int argc, char *argv[])
> struct sigaction act;
>
> 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);
> act.sa_flags = 0;
> act.sa_handler = interrupt_handler;
> sigaction(i, &act, NULL);
--
Gregory Kurz gkurz at fr.ibm.com
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)534 638 479 Fax +33 (0)561 400 420
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
More information about the lxc-devel
mailing list