chiark / gitweb /
base/dispatch.c, etc.: Check that `rdrand' works.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 30 Oct 2019 00:45:11 +0000 (00:45 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 16 Dec 2019 16:25:17 +0000 (16:25 +0000)
commit35b1eba81a20fa0b93db161001ad8a46cd0cdc7b
tree4093463728651feb53e688b7de0535599891a814
parent710440c8a83df5949e6ed5f4085717dfab5c4877
base/dispatch.c, etc.: Check that `rdrand' works.

When probing for `rdrand', check to make sure that it doesn't just
return the same thing every time, and that it can reasonably well make
progress.  We check that up to five 32-bit samples are not all the same,
which will mistakenly mark a working CPU as defective with probability
2^-128.

It seems that some processors will return a constant value from `rdrand'
but set the carry flag to indicate that it's properly random anyway.
See

https://arstechnica.com/gadgets/2019/10/how-a-months-old-amd-microcode-bug-destroyed-my-weekend/

as an example.
base/dispatch.c