Skip to content

Commit 8841378

Browse files
authored
Rollup merge of rust-lang#56710 - jethrogb:jb/sgx-target-features, r=alexcrichton
Always set the RDRAND and RDSEED features on SGX Not sure if this is 100% correct. This [Intel article](https://software.intel.com/en-us/articles/intel-software-guard-extensions-tutorial-part-5-enclave-development) goes in great depth regarding using (untrusted) CPUID to see whether RDRAND/RDSEED is supported, and explains what happens to the enclave if the CPUID result is faked. I'd say that an implementation of SGX that doesn't make RDRAND available to the enclave is so severely limited/broken that it's ok if you get #UD in that case. The case is less clear for RDSEED, but it so far every processor released by Intel with SGX support also has RDSEED (including Gemini Lake). cc @briansmith
2 parents d206dca + 5acab2d commit 8841378

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub fn target() -> Result<Target, String> {
4949
max_atomic_width: Some(64),
5050
panic_strategy: PanicStrategy::Abort,
5151
cpu: "x86-64".into(),
52+
features: "+rdrnd,+rdseed".into(),
5253
position_independent_executables: true,
5354
pre_link_args: iter::once(
5455
(LinkerFlavor::Gcc, PRE_LINK_ARGS.iter().cloned().map(String::from).collect())

0 commit comments

Comments
 (0)