From: Oleg Nesterov on
On 06/08, KOSAKI Motohiro wrote:
>
> Oleg pointed out oom_kill.c has force_sig() abuse. force_sig() mean
> ignore signal mask. but SIGKILL itself is not maskable.

Yes. And we have other reasons to avoid force_sig(). It should be used
only for synchronous signals.

But,

> @@ -399,7 +399,7 @@ static int __oom_kill_process(struct task_struct *p, struct mem_cgroup *mem)
> p->rt.time_slice = HZ;
> set_tsk_thread_flag(p, TIF_MEMDIE);
>
> - force_sig(SIGKILL, p);
> + send_sig(SIGKILL, p, 1);

This is not right, we need send_sig(SIGKILL, p, 0). Better yet,
send_sig_info(SIGKILL, SEND_SIG_NOINFO). I think send_sig() should
die.

The reason is that si_fromuser() must be true, otherwise we can't kill
the SIGNAL_UNKILLABLE (sub-namespace inits) tasks.

Oh. This reminds me, we really need the trivial (but annoying) cleanups
here. The usage of SEND_SIG_ constants is messy, and they should be
renamed at least.

And in fact, we need the new one which acts like SEND_SIG_FORCED but
si_fromuser(). We do not want to allocate the memory when the caller
is oom_kill or zap_pid_ns_processes().

OK. I'll send the simple patch which adds the new helper with the
comment. send_sigkill() or kernel_kill_task(), or do you see a
better name?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: KOSAKI Motohiro on
> On 06/08, KOSAKI Motohiro wrote:
> >
> > Oleg pointed out oom_kill.c has force_sig() abuse. force_sig() mean
> > ignore signal mask. but SIGKILL itself is not maskable.
>
> Yes. And we have other reasons to avoid force_sig(). It should be used
> only for synchronous signals.
>
> But,
>
> > @@ -399,7 +399,7 @@ static int __oom_kill_process(struct task_struct *p, struct mem_cgroup *mem)
> > p->rt.time_slice = HZ;
> > set_tsk_thread_flag(p, TIF_MEMDIE);
> >
> > - force_sig(SIGKILL, p);
> > + send_sig(SIGKILL, p, 1);
>
> This is not right, we need send_sig(SIGKILL, p, 0). Better yet,
> send_sig_info(SIGKILL, SEND_SIG_NOINFO). I think send_sig() should
> die.
>
> The reason is that si_fromuser() must be true, otherwise we can't kill
> the SIGNAL_UNKILLABLE (sub-namespace inits) tasks.

Thanks. I am not signal expert.
To be honest, current special siginfo arguments have a bit unclear meanings
to me ;)
current definition (following) doesn't teach anything.

sched.h
=====================
/* These can be the second arg to send_sig_info/send_group_sig_info. */
#define SEND_SIG_NOINFO ((struct siginfo *) 0)
#define SEND_SIG_PRIV ((struct siginfo *) 1)
#define SEND_SIG_FORCED ((struct siginfo *) 2)


If anyone write exact meanings, I'm really really glad.



> Oh. This reminds me, we really need the trivial (but annoying) cleanups
> here. The usage of SEND_SIG_ constants is messy, and they should be
> renamed at least.
>
> And in fact, we need the new one which acts like SEND_SIG_FORCED but
> si_fromuser(). We do not want to allocate the memory when the caller
> is oom_kill or zap_pid_ns_processes().
>
> OK. I'll send the simple patch which adds the new helper with the
> comment. send_sigkill() or kernel_kill_task(), or do you see a
> better name?

Very thanks. both name are pretty good to me.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/