WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Ian Campbell <ian.campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 5 of 9] xl: Add function to generate random uuid and use it
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Tue, 27 Jul 2010 12:47:37 +0100
Cc: Ian, Campbell <Ian.Campbell@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 27 Jul 2010 04:50:46 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <a31105a3eb9d57d03711.1280225627@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <a31105a3eb9d57d03711.1280225627@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>