Re: clone() <-> getpid() bug in 2.6?

Erik Andersen
2004-06-06T07:58:11Z

On Sat Jun 05, 2004 at 11:07:25PM -0700, Linus Torvalds wrote:
> qmail is a piece of crap. The source code is completely unreadable, and it
> seems to think that "getpid()" is a good source of random data. Don't ask
> me why.
>
> It literally does things like
>
> random = now() + (getpid() << 16);
[-----------snip-----------]

http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/sysdeps/posix/tempname.c?rev=1.36&content-type=text/plain&cvsroot=glibc

/* Get some more or less random data. */
random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
value += random_time_bits ^ __getpid ();

etc....

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--