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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.