News for hackers. Stuff that matters.
Re:Some AMD CPU's RDRAND might not return random data after ... by ricardobeat on Tuesday May 07, 2019 @11:51AM (#19850623)
Later in the thread:

> Given that RDRAND is allowed to fail, it seems to me that you should either try it only once, or only a few times, before falling back to whatever code is used when RDRAND is not implemented.

Re:Some AMD CPU's RDRAND might not return random data after ... by JdeBP on Tuesday May 07, 2019 @01:49PM (#19851740)
... which is what the systemd code actually does. The problem is that there appears to be a possible AMD processor state, caused by suspend+resume, where the instruction succeeds but the data returned are not in fact random.
Re:Some AMD CPU's RDRAND might not return random data after ... by ricardobeat on Wednesday May 08, 2019 @05:12AM (#19857134)
There is no mention anywhere, in this thread nor the one from 2014, of it returning non-random data from the issue reporters, just assumptions from onlookers.
Re:Some AMD CPU's RDRAND might not return random data after ... by JdeBP on Wednesday May 08, 2019 @07:36AM (#19857851)
Re:Some AMD CPU's RDRAND might not return random data after ... by loeg on Tuesday May 07, 2019 @06:47PM (#19854149)
The other problem is that systemd's fallback is a non-random PRNG.
Re:Some AMD CPU's RDRAND might not return random data after ... by JdeBP on Tuesday May 07, 2019 @07:57PM (#19854607)
Only if a RANDOM_EXTEND_WITH_PSEUDO flag is set. But in fact, that flag is nowhere set in systemd outwith unit testing code. So it is not in fact another problem.

Even if it were used, the calls to rand() would only happen if RDRAND first succeeded and then failed. If RDRAND always failed, systemd's true fallback is actually to getrandom() and thence to /dev/urandom. However, AMD claims in its doco that there is a FIFO of generated data provided for satisfying bursts of multiple RDRAND instructions, so it is supposedly unlikely to succeed and then fail, especially for the amounts of random data in the case at hand.

AMD does not say, though, whether the FIFO is big enough to complete a 128-bit GUID, and this does after all involve a processor that can enter a mode where RDRAND succeeds and gives a constant result. It's not wholly beyond the bounds of possibility that AMD made the FIFO too small as well.