Re: [PATCH] kill_something_info: don't take tasklist_lock for pid==-1 case

Eric W. Biederman
2008-05-28T15:11:00Z

Atsushi TSUJI <a-tsuji@bk.jp.nec.com> writes:

>> Call me paranoid but I don't think there is any guarantee without a lock
>> that we will hit the -ERESTARTNOITR check for new processes. I think we
>> have a slight race where the fork process may not have received the signal
>> (because it is near the tail of the list) but the new process would be
>> added to the list immediately after we read it's pointer.
>
> I know it might happen some races, but, as Oleg say, it is no problem
> on the user side. Users cannot realize whether the process forked
> during kill or after. We can pretend it was forked after kill
> finished. So I think the change to convert tasklist_lock to
> rcu_read_lock is reasonable way to avoid the local DOS for kill(-1,sig) case.

We can only pretend that if the parent lives. If the parent is killed
then we can not so pretend.

Which in a lot of ways is the problem. kill(-1,SIGKIL) should
kill everything except for init and the process that sent the
signal. If anything else survives we have a broken the shutdown
scripts.

Since the race would rarely hit it will take ages for someone
to trace back to a kernel change.

If I could convince myself that Oleg is correct and that what
Oleg is proposing will always work I don't have a problem.

Eric