NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/25367: arc4random state is shared across forks
The following reply was made to PR lib/25367; it has been noted by GNATS.
From: David Laight <david%l8s.co.uk@localhost>
To: gnats%netbsd.org@localhost
Cc:
Subject: Re: lib/25367: arc4random state is shared across forks
Date: Sun, 19 Aug 2012 09:01:48 +0100
Just bumped into this one while looking at other arc4random bugs.
There are two freebsd threads from september 2008 explaining that
openbsd had added a getpid() call prior to every arc4random() one
in order to detect this - butthat is slow. See:
http://lists.freebsd.org/pipermail/freebsd-current/2008-September/088552.html
There is a more general problem of detecting fork() - arc4random()
isn't the only affected code.
Optimising getpid() (or having an optimised getpid() function) is one
possibility. All that requires is for libc to zero the cached pid
value in the child of fork().
Although vfork() and others? may need special consideration.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index