Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm surprised "MAC" never appears in the paper. Does Linux happily pickup a new MAC "on wake-up"?


You could hotplug different hardware, but having a unique MAC address isn't very important if you're on a virtual network where you only talk to the host to get your traffic routed. A unique MAC is only important if you put the cloned VMs on the same network segment.


What do MAC addresses have to do with rng? Are you thinking of the old style UUIDs that used the machines's MAC address and system time? What a terrible idea that was.


I assume not reusing a MAC address falls into the same bucket of "make sure the VMs are not too similar" rather than anything specific to random number generation.


Hit that exact bug with a customer at work in libvirt. Two machines booted at approximately the same time generated a VM with the same Mac. Due to very poor choices of random seed using the boot time and PID and xoring which made that even less random.

Details here: https://bugs.launchpad.net/bugs/1710341

It was since fixed though I never updated the bug.

src/util/virrandom.c:virRandomOnceInit seeds the random number generator using this formula: unsigned int seed = time(NULL) ^ getpid();

This seems to be a popular method after a quick google but it's easy to see how this can be problematic. The time is only in seconds, and during boot of a relatively identical system these numbers are both likely to be relatively similar across multiple systems which is quite likely in cloud-like environments. Secondly, by using bitwise OR only a small difference is created and if the 1st or 2nd MSB of the pid or time are 0 then it would be easy to have colliding values.

Though problematic from basic logic, I also tested this with a small test program trying 67,921 unique combinations of time() and pid() which produced only 5,693 random seeds using PID range 6799-6810 and time() range 1502484340 to 1502489999.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: