bug-parted
[Top][All Lists]
Advanced

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

bug#15366: MBR disk signature not random enough


From: Philip Rowlands
Subject: bug#15366: MBR disk signature not random enough
Date: Fri, 13 Sep 2013 14:06:30 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

libparted/labels/dos.c:generate_random_id()
is used to create a new mbr_signature where none exists. The possible return values for generate_random_id() range from 0 to 999999, derived from the tv_usec field of gettimeofday(2).

This limits the actual value written to mbr_signature to 0.023% of the possible uint32 values.

I don't know how many MBRs in the world libparted has written the mbr_signature to, but the chance of collisions are greatly increased by having an artificially restricted value.

Is there a better libc-provided rand(3)/random(3) function which can be used to provide a full 32 bits of randomness?

I haven't checked all the other mklabel types, but it's possible they have similar limitations. gpt.c uses uuid_generate() which delegates the task to libuuid. Perhaps this could be used (with truncated output) for the MBR signature?

Cheers,
Phil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]