Re: [RFC][PATCH 5/6][v3] Protect cinit from unblocked SIG_DFLsignals

From: Oleg Nesterov
Date: Mon Dec 22 2008 - 17:48:20 EST


On 12/20, Sukadev Bhattiprolu wrote:
>
> +static int sig_task_unkillable(struct task_struct *t, int same_ns)
> +{
> + int flags = t->signal->flags;
> +
> + if (unlikely(flags & SIGNAL_UNKILLABLE) ||
> + (same_ns && (flags & SIGNAL_UNKILLABLE_FROM_NS)))
> + return 1;

Hmm. I do not understand the point of the new flag,
SIGNAL_UNKILLABLE_FROM_NS (patch 3/6).

Actually, "same_ns" is a bad name, imho. It actually means "not from
parent ns", and this is not the same as "from the same ns".

Let's suppose we rename it, then the code becomes

if (unlikely(flags & SIGNAL_UNKILLABLE) ||
(!parent_ns && (flags & SIGNAL_UNKILLABLE_FROM_NS)))

But, parent_ns == T is not possible for the global init, so why
do we need the extra flag? we can just do

if (unlikely(flags & SIGNAL_UNKILLABLE) && !parent_ns)
return 1;

No?

> @@ -867,11 +886,17 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
> {
> struct sigpending *pending;
> struct sigqueue *q;
> + int same_ns;
>
> trace_sched_signal_send(sig, t);
>
> assert_spin_locked(&t->sighand->siglock);
> - if (!prepare_signal(sig, t))
> +
> + same_ns = 1;
> + if (siginfo_from_ancestor_ns(t, info))
> + same_ns = 0;

This looks a bit strang, why not

same_ns = siginfo_from_ancestor_ns(t, info);

?

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/