The second patch is just an example of how the new helper can be used outside
of schedule(), it doesn't change the behaviour.
I am not sure about the 3rd patch (it doesn't depend on the 1st patch),
On 06/05, Oleg Nesterov wrote:
>
> Please note that while this bug is not likely,
> it is _not_ theoretical. It does happen that user-space sends the unhandled
> fatal signals to init.
>
> Imho, this is 2.6.26 material. Unless I missed something, of course.
Of course, I missed something. Firstly, init doesn't read files that often.
And, unlike the normal task, init can't be woken by the fatal signal unless
this signal is SIGKILL. I doubt user-space can send SIGKILL to init. So this
problem is minor.
To clarify, this patch doesn't fix the bug. We need changes in signal.c, but
unfortunately it is not as easy as I thought, it needs more thinking. For
example, we can change signal_wake_up() to check SIGNAL_UNKILLABLE before
"|= TASK_WAKEKILL", but this is a) not exactly right (exec), and b) can't
really help. The problem is that __fatal_signal_pending(init) is not right,
but signal_group_exit() needs ->signal and thus isn't useable from schedule().
Of course we can add a check into send_signal(), but this is so nasty...