Skip to content

Commit 72aeedb

Browse files
authored
Unrolled build for #144960
Rollup merge of #144960 - raoulstrackx:raoul/rte-513-disable_sleep_tests_on_sgx, r=Mark-Simulacrum [RTE-513] Ignore sleep_until test on SGX #141829 added a test for `sleep_until`: it checks whether its specification holds: > Puts the current thread to sleep until the specified deadline has passed. but in SGX there's no secure time source. There's only the ability to request the `insecure_time` from outside of the enclave through a [usercall](https://github.com/fortanix/rust-sgx/blob/master/intel-sgx/fortanix-sgx-abi/src/lib.rs#L590-L592) and the ability to [wait](https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/sgx/abi/usercalls/mod.rs#L173-L179) for a certain event or timeout. But both are under the control of an attacker; users should not depend on the accuracy nor correctness of this time. We try to even enforce this by adding a +/-10% time interval to wait usercalls. The current `thread::sleep_until` implementation uses this `wait` usercall. When a negative randomization interval is added to the timeout passed in `wait`, the test fails. As users should not rely on the correctness of any time inside the enclave, it should be considered an incorrect test on SGX. This PR ignores this test.
2 parents b96868f + 3a993a6 commit 72aeedb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/std/tests/thread.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn sleep_very_long() {
1919
}
2020

2121
#[test]
22+
#[cfg_attr(target_env = "sgx", ignore = "Time within SGX enclave cannot be trusted")]
2223
fn sleep_until() {
2324
let now = Instant::now();
2425
let period = Duration::from_millis(100);

0 commit comments

Comments
 (0)