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

Add timeout support #31

Open
jethrogb opened this issue Nov 20, 2018 · 2 comments · Fixed by rust-lang/rust#73269
Open

Add timeout support #31

jethrogb opened this issue Nov 20, 2018 · 2 comments · Fixed by rust-lang/rust#73269
Labels
C-fortanix-sgx-abi Crate: fortanix-sgx-abi enhancement needs-design std/rustc Requires changes in Rust std/rustc

Comments

@jethrogb
Copy link
Member

jethrogb commented Nov 20, 2018

The following operations in std require some form of timeout support:

  • TcpStream::connect_timeout
  • TcpStream::set_read_timeout
  • TcpStream::set_write_timeout
  • thread::sleep
  • thread::sleep_ms
  • thread::park_timeout
  • thread::park_timeout_ms
  • Condvar::wait_timeout
  • mpsc::Receiver::recv_timeout

Currently, the first just doesn't use a timeout, and the rest errors/panics.

The ABI currently does not support waiting a specified amount (only no wait or indefinite wait): https://docs.rs/fortanix-sgx-abi/0.1.0-rc1/fortanix_sgx_abi/struct.Usercalls.html#method.wait . It's also not clear if timeouts make sense in SGX setting, in particular: is it the case that users depend on accurate timeouts for security purposes?

@jethrogb jethrogb added enhancement C-fortanix-sgx-abi Crate: fortanix-sgx-abi std/rustc Requires changes in Rust std/rustc needs-design labels Nov 20, 2018
@jethrogb
Copy link
Member Author

jethrogb commented Dec 7, 2018

sleep, park, and Condvar can be fixed by allowing more values for the timeout parameter to the wait usercall.

More work is needed to support read/write/connect. Here are some ideas:

Option 1

Add a way to cancel async usercalls, then do the async call in conjunction with wait with timeout. If wait returns first, cancel the async call.

Cancellation here means that the call should return immediately. It may still return succesfully if it was completed in the mean time.

Option 2

Add *const Usercall/*mut Return to wait(), to specify timeout for a specific call.

Concern: Is this a reasonable API? How does this behavior interact with event_mask and allowed spurious wakeups?

Option 3

Add timeout() usercall, very similar to “Option 2”, except that there is a dedicated API.

Concern: API size increase.

@jethrogb
Copy link
Member Author

jethrogb commented Apr 1, 2019

Should the API use deadlines or timeouts?

mzohreva added a commit that referenced this issue Jun 11, 2020
This should partially address issue #31
mzohreva added a commit to mzohreva/rust that referenced this issue Jun 12, 2020
mzohreva added a commit that referenced this issue Jul 1, 2020
This should partially address issue #31
mzohreva added a commit that referenced this issue Jul 15, 2020
This should partially address issue #31
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 17, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 17, 2020
…hrogb

Enable some timeouts in SGX platform

This would partially resolve fortanix/rust-sgx#31

cc @jethrogb and @Goirad
bors bot added a commit that referenced this issue Jul 20, 2020
252: Allow arbitrary timeouts for wait usercall r=jethrogb a=mzohreva

This should partially address issue #31

Co-authored-by: Mohsen Zohrevandi <mohsen.zohrevandi@fortanix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-fortanix-sgx-abi Crate: fortanix-sgx-abi enhancement needs-design std/rustc Requires changes in Rust std/rustc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant