Re: [PATCH 1/2] signals: collect_signal: remove the unneeded sigismember() check

From: Oleg Nesterov
Date: Wed May 21 2008 - 09:21:06 EST


On 05/20, Roland McGrath wrote:
>
> > It's basically the equivalent of a "spin_lock_irq()" for DRM, where
> > signals are the "interrupts" that need to be blocked while holding the
> > lock.
>
> Well, sure, that makes sense. But that's not what it does. I can see what
> it does, I just can't tell why it really makes any sense.

As for me, I can't even see what it does,

> Despite the name, block_all_signals() in fact blocks no signals. What
> it does is install notifier/notifier_mask, which makes the hook get
> called for those particular signals and it can decide to delay the
> signal (in a kooky fashion that's not really reliable).

Suppose that the task has the pending SIG which is "blocked" by DRM.

dequeue_signal() calls ->notifier(), it nacks the signal, we clear
TIF_SIGPENDING. Then dequeue_signal() does recalc_sigpending() and
sets TIF_SIGPENDING again. We return 0 to get_signal_to_deliver(),
and then return to user-space with TIF_SIGPENDING. Endless loop ?

Even if it works somehow... "blocking" SIG means that in fact we
"block" SIG+1, SIG+2, etc if SIG is pending.

> drm_lock uses a mask containing only the stop signals (SIGSTOP, SIGTSTP,
> SIGTTOU, SIGTTIN).

and of course this can't work for multithread programs, another
thread can dequeue SIGTSTP and initiate a group stop.

Oleg.

--
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/