On 12/20, Sukadev Bhattiprolu wrote:
> 
> +static int sig_unkillable(struct signal_struct *signal, int sig)
> +{
> +     if (signal->flags & SIGNAL_UNKILLABLE_FROM_NS)
> +             return !sig_kernel_only(sig);
> +
> +     /*
> +      * We must have dropped SIGKILL/SIGSTOP in sig_ignored()
> +      * TODO: Remove BUG_ON().
> +      */
> +     BUG_ON(signal->flags & SIGNAL_UNKILLABLE && sig_kernel_only(sig));
> +
> +     return (signal->flags & SIGNAL_UNKILLABLE);
> +}
> +
>  int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
>                         struct pt_regs *regs, void *cookie)
>  {
> @@ -1907,9 +1943,10 @@ relock:
>
>               /*
>                * Global init gets no signals it doesn't want.
> +              * Container-init gets no signals it doesn't want from same
> +              * container.
>                */
> -             if (unlikely(signal->flags & SIGNAL_UNKILLABLE) &&
> -                 !signal_group_exit(signal))
> +             if (sig_unkillable(signal, signr) && !signal_group_exit(signal))
>                       continue;

Again, I do not understand why do we need SIGNAL_UNKILLABLE_FROM_NS.

I thought about the change in get_signal_to_deliver() during the
previous discussion, and I think what we need is:

                if (unlikely(signal->flags & SIGNAL_UNKILLABLE) &&
                    !sig_kernel_only(sig))
                        continue;

and this was yet another reason for "protect init from unwanted signals more".

Because, if we see SIGKILL/SIGSTOP here, this means that the signal
was sent from the parent ns, or it was generated "internally", for
example by sys_exit_group().

Oleg.

_______________________________________________
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel

Reply via email to