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

From: Eric W. Biederman
Date: Wed May 28 2008 - 11:11:28 EST


Atsushi TSUJI <a-tsuji@xxxxxxxxxxxxx> 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
--
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/