Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for AMD RDRAND bug #43

Merged
merged 2 commits into from
Jun 29, 2019
Merged

Check for AMD RDRAND bug #43

merged 2 commits into from
Jun 29, 2019

Conversation

josephlr
Copy link
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".

Copy link
Member

@newpavlov newpavlov left a comment

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.

src/rdrand.rs Show resolved Hide resolved
src/rdrand.rs Outdated Show resolved Hide resolved
Sign up for free to 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.

None yet

2 participants