Signal handling possibly wrong

From: Bodo Stroesser
Date: Tue Aug 09 2005 - 12:44:54 EST


Hi,

reading man pages for sigaction and comparing it to what kernel does
when starting a signal handler (i386, s390, ppc and others), I think
one of both might be wrong.

From man pages:

sa_mask gives a mask of signals which should be blocked during
execu­tion of the signal handler. In addition, the signal which
triggered the handler will be blocked, unless the SA_NODEFER or
SA_NOMASK flags are used.

From arch/i386/kernel/signal.c:

if (ret && !(ka->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
sigaddset(&current->blocked,sig);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
}


If I understand man pages correctly, the handled signal should be blocked
depending on SA_NODEFER, while sa_mask should be used unconditionally to
block additional signals.
Kernel code blocks both "handled signal" _and_ sa_mask only if SA_NODEFER
isn't set.

Which is the right behavior?

Regards
Bodo

P.S.:
Please CC me, I'm not on the list.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/