(no title)
marios | 6 years ago
OpenBSD conveniently provides arc4random() in its libc for applications to use, and the same function is available for kernel components (obviously one needs to include different headers).
marios | 6 years ago
OpenBSD conveniently provides arc4random() in its libc for applications to use, and the same function is available for kernel components (obviously one needs to include different headers).
zx2c4|6 years ago
Other facilities in the kernel, such as ASLR, also use get_random_u32().
Many things in the kernel use get_random_u32(). That's the proper function to use.
When presented with this bug, the upstream kernel maintainers chose not to fix get_random_u32(), due to the availability (?) of microcode updates for AMD chips. That's not my decision. WireGuard is just a mere consumer of get_random_u32(), like all other modules. This is an upstream kernel bug.
unknown|6 years ago
[deleted]
zaroth|6 years ago
So says a maintainer of WireGuard. HN is beautiful sometimes.
If RANDOM_TRUST_CPU is disabled, that will stop the kernel function from using RDRAND and avoid this issue for anyone using the ‘get_random_u32()’ function?
dingo_bat|6 years ago
[deleted]
dfox|6 years ago
On the other hand it is somewhat worrisome that brokenness of RDRAND can affect output of Linux's RNG that much.
cyphar|6 years ago
There is assembly in WireGuard for the crypto primitive implementations, but those are generated by scripts and are based on either formally-proven implementations or highly-vetted ones.
[1]: https://elixir.bootlin.com/linux/v5.3.6/source/drivers/char/...
marios|6 years ago
tedunangst|6 years ago
throw0101a|6 years ago
There's been a bit of drama around it:
* https://news.ycombinator.com/item?id=21114524 (Oct 2)
* https://news.ycombinator.com/item?id=21290306 (Oct 19)
thenewnewguy|6 years ago
gargravarr|6 years ago
nocturnial|6 years ago
I know I'm nitpicking but I disagree with that statement.
There's a kernel option called CONFIG_RANDOM_TRUST_CPU which you can set to false. So if for some reason, even if it's a bad one, you don't want your random numbers generated by your cpu then that's that. End of discussion. (In theory, not sure if rdrand if trapable)
I get that you're skeptical about the quality of what's provided in /dev/(u)random because in most cases it's true. Should I ever feel the need to hookup a hw random generator then I hope programs would use that one instead of guessing they can do better by calling rdrand.