Skip to content

Check for AMD RDRAND bug - #43

Merged
newpavlov merged 2 commits into
rust-random:masterfrom
josephlr:rdrand
Jun 29, 2019
Merged

Check for AMD RDRAND bug#43
newpavlov merged 2 commits into
rust-random:masterfrom
josephlr:rdrand

Conversation

@josephlr

Copy link
Copy Markdown
Member

Pre-Ryzen AMD CPUs have a very serious bug where they will sometimes give 0xFFFFFFFF as the output of RDRAND without setting the carry flag. This issue usually occurs when those CPU's awake from sleep: systemd/systemd#11810 (comment)

This CL simply implement's systemd's fix, where they check for the bogus value and issue an error.

This PR also cleans up the target_feature checks. As we already fail to compile on sgx when rdrand is not enabled, the is_rdrand_supported function checks can just be target_feature = "rdrand".

@newpavlovnewpavlov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wow... Quite a disaster from AMD.

Comment threadsrc/rdrand.rs
Comment threadsrc/rdrand.rs Outdated
@newpavlov
newpavlov merged commit 5b56734 into rust-random:masterJun 29, 2019
@josephlr
josephlr deleted the rdrand branch June 29, 2019 00:36
takumi-earth pushed a commit to earthlings-dev/getrandom that referenced this pull request Jan 27, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@josephlr@newpavlov