[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 5 of 9] xl: Add function to generate random uuid and use it



On Tue, 2010-07-27 at 11:13 +0100, Ian Campbell wrote:
> +static void random_uuid(uint8_t *uuid)
> +{
> +    int i;
> +    for (i = 0; i < 16; i++)
> +        uuid[i] = rand();
> +}
> +

Nothing wrong with the patch but draws my attention to the fact that
this method seems far too likely to collide UUID's, for example in xl
invocations started during the same second. Why not use system entropy
pool? eg. scanf contents of /proc/sys/kernel/rand/uuid... I'm aware this
ought to be portable but PRNG can always be a fallback.

Gianni


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.