Is fork() hook ever possible?
ache at nagual.pp.ru
Wed Sep 17 07:55:16 UTC 2008
On Tue, Sep 16, 2008 at 08:41:33PM +0000, Poul-Henning Kamp wrote:
> In message <200809161628.54085.jhb at freebsd.org>, John Baldwin writes:
> >The PID isn't the seed, he's using a PID change as a notification that the
> >process needs to do a re-stir the next time it wants a psuedo-random number
> >(b/c the PID change means it is now a new process).
> Seems to be a vast overkill to me, in countless other contexts,
> it is the responsibility of the programmer to do what needs done on
> a fork, and I see no reason why this couldn't be likewise.
The situation is not so simple since the library functions can call
ar4random() internally (like mktemp() family already and always does) and
the programmer should always know all of such usage (which is impossible)
or always call arc4random_stir() directly by himself (which no portable
code will do).
More information about the freebsd-current