# Collision likelihood from /dev/urandom for VMs using the same underlying hardware

We have multiple virtual machines sharing the same physical hardware. We use /dev/urandom for session key generation. But a question comes up: if /dev/urandom utilizes metrics from the physical hardware for entropy, isn't there an increased risk of duplicates for VMs on shared hardware if calls are made at the same exact time?

There are at least two important things that can go wrong with VM randomness:

1. They could end up with the same "entropy" input and produce same/related numbers.
2. Someone with access to one VM could be able to predict the "random" inputs of another VM.

In a simple setup each VM has their own pool, they get initialized with saved values on startup and they make their own measurements that they feed into the pool. Only on first start (or two starts from a checkpoint), when they have constant initialization could they start off with identical numbers and be slow to gather enough entropy to diverge. (If you have a CPU with RDRAND/RDSEED this should never happen, since that is mixed into the pool frequently.)

The second issue is more difficult to gauge. Again, access to hardware random numbers avoids the issue, but theoretically the other VM could have influence on or be able to predict the "random" measurements otherwise.

It is common to use paravirtualization to handle the problem for good. By having the host generate independent random numbers for the guests, their random number generators will generate independent numbers.