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

From: Erik Andersen
Date: Sun Jun 06 2004 - 02:59:13 EST


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--
-
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/