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

Manually patch ret instruction for LVI #359

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

jethrogb
Copy link
Contributor

@jethrogb jethrogb commented May 27, 2020

@jethrogb
Copy link
Contributor Author

cc @raoulstrackx

@alexcrichton
Copy link
Member

To avoid on the #[cfg] soup, could this perhaps just have an entirely separate definition for sgx?

@jethrogb
Copy link
Contributor Author

jethrogb commented May 28, 2020

I may have misunderstood, are you suggesting to duplicate the whole 50-line function? That seems like unnecessary duplication to me and it would also introduce the risk that only one of the two functions would get updated when needed.

@alexcrichton
Copy link
Member

Yes, that is what I'm suggesting. I'm not sure this function has changed since it was added, and it's easy enough that if a substantial change happens it's mirrored elsewhere. This crate already suffers from lots of #[cfg] and trying to conditionalize one instruction makes it even harder to further understand.

@jethrogb
Copy link
Contributor Author

Updated as requested

@@ -163,6 +168,69 @@ global_asm!(define_rust_probestack!(
"
));

// This function is the same as above, except that some instructions are
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it may be reasonable for SGX to have its own implementation in the future because it likely knows a priori how big the stack is. We'll leave that for a future change though.

@alexcrichton alexcrichton merged commit f853d6d into rust-lang:master Jun 1, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 8, 2020
…enkov

Enable LVI hardening for x86_64-fortanix-unknown-sgx

This implements mitigations for the Load Value Injection vulnerability (CVE-2020-0551) for the `x86_64-fortanix-unknown-sgx` target by enabling new LLVM passes. More information about LVI and mitigations may be found at https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection.

This PR unconditionally enables the mitigations for `x86_64-fortanix-unknown-sgx` since there is no available hardware that doesn't require the mitigations. This may be reconsidered in the future.

* [x] This depends on rust-lang/compiler-builtins#359
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.

2 participants