On Wed, 2006-01-11 at 13:49 +0000, Ian Campbell wrote:
> On Wed, 2006-01-11 at 14:25 +0100, Bernd Petrovitsch wrote:
> > Then this leaves the race if an old pid is reused in a newly created
> > process before the last instances of that pid is cleaned up.
>
> The PID won't be available to be re-used until the signal handler has
> called waitpid() on it?
Yes.
But ATM the signal handler calls waitpid() and stores the pid in a
to-be-cleaned-pids array (at time X).
The main loop at some time in the future (say at time X+N) walks through
the to-be-cleaned-pids array and cleans them from the active-childs
array.
If a new process is started between X and X+N with a pid in the
to-be-cleaned-pids it may happen (depends on the implementation - if the
active-childs array is "sorted" as childs are created (i.e. just append
the new pid at the end), holes of terminated childs are closed with
moving the rest of array and *never* reordered, than it may even work
then) that the wrong one (or both) are cleaned up.
But IMHO a too fragile solution in the log run as this doesn't scale and
people are inclined to tune it with sorting, hashing, etc.
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]