Re: [PATCH 2/4] signals: send_signal: use si_fromuser() to detect from_ancestor_ns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/05, Sukadev Bhattiprolu wrote:
>
> Oleg Nesterov [oleg@xxxxxxxxxx] wrote:
> | On 10/05, Sukadev Bhattiprolu wrote:
> | >
> | > Oleg Nesterov [oleg@xxxxxxxxxx] wrote:
> | > |
> | > | --- TTT_32/kernel/signal.c~FU_2_SEND_SIGNAL	2009-10-04 02:21:55.000000000 +0200
> | > | +++ TTT_32/kernel/signal.c	2009-10-04 03:09:44.000000000 +0200
> | > | @@ -928,9 +928,8 @@ static int send_signal(int sig, struct s
> | > |  	int from_ancestor_ns = 0;
> | > |
> | > |  #ifdef CONFIG_PID_NS
> | > | -	if (!is_si_special(info) && SI_FROMUSER(info) &&
> | > | -			task_pid_nr_ns(current, task_active_pid_ns(t)) <= 0)
> | > | -		from_ancestor_ns = 1;
> | > | +	from_ancestor_ns = si_fromuser(info) &&
> | > | +			   !task_pid_nr_ns(current, task_active_pid_ns(t));
> | >
> | > Makes sense. And we had mentioned earlier that container-init is immune
> | > to suicide but should we add a check for 'current == t' above to cover the
> | >
> | > 	send_sig(SIGKILL, current, 0);
> | >
> | > in load_aout_binary() and friends
> | >
> | > 	from_ancestor_ns = si_fromuser(info) && (current == t ||
> | > 				!task_pid_nr_ns(current, task_active_pid_ns(t)));
> |
> | I don't think so.
> |
> | First of all, this is just ugly. If we need this check we should change
> | the callers, not send_signal().
>
> Well, all I am saying is that the check
>
> 	!task_pid_nr_ns(current, task_active_pid_ns(t)))
>
> excludes container-init sending signal to itself - task_pid_nr_ns() above
> would return 1 for container-init and 'from_ancestor_ns' would be 0.

Ah, I misunderstood you, and I misread the "current == t" check above.
I wrongly thought that you suggest to suppress "si_fromuser()" when
the task sends a signal to itself.

Sorry for confusion.

> But sure, we could use force_sig_info() in caller.

Yes, because this makes the code more explicit imho. And we can avoid
the further complicatiions in send_signal() path.

> | So, imho this patch also fixes this case by accident,
>
> This part I am not sure.  But as mentioned above, from_ancestor_ns is 0
> and the SIGKILL will not queued right ?

Yes, you are right, see above.

I meant, it fixes the from-user logic, not from_ancestor_ns logic.

Oleg.

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

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux