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

Tracking issue: platform-specific APIs for SGX target #56975

Open
6 tasks
jethrogb opened this issue Dec 19, 2018 · 12 comments
Open
6 tasks

Tracking issue: platform-specific APIs for SGX target #56975

jethrogb opened this issue Dec 19, 2018 · 12 comments
Labels
B-unstable Feature: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. Libs-Tracked Libs issues that are tracked on the team's project board. O-SGX Target: SGX S-tracking-design-concerns Status: There are blocking ❌ design concerns. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@jethrogb
Copy link
Contributor

jethrogb commented Dec 19, 2018

This issue tracks the functionality available behind the sgx_platform feature gate.

Relevant PRs:

TODO:

  • arch module
  • ffi module
    • No concerns
  • io module
    • No concerns
  • mem module
    • No concerns, but no evidence of real-world usage
  • thread module
    • No concerns
  • usercalls module
    • This is all pretty untested outside of std

For more information about the target, see https://edp.fortanix.com

@joshtriplett
Copy link
Member

cc @jsakkine-intel

@ghost
Copy link

ghost commented Dec 20, 2018

Thanks. Interesting development. I haven't really followed Fortanix SGX stack development that closely. If I wanted to write a test program with this what would be the easy steps to get started?

@jethrogb
Copy link
Contributor Author

jethrogb commented Dec 20, 2018

@jsakkine-intel the toolchain is still in flux, the steps keep changing quite frequently these days. Right now, this should do it (if you have PSW & SDK driver installed):

rustup update nightly
cargo install xargo
cargo install sgxs-tools --version 0.6.0-rc1
cargo install fortanix-sgx-tools --version 0.1.0-rc1
# Soon, instead: cargo install fortanix-sgx-tools --git https://github.com/fortanix/rust-sgx
cargo new --bin sgxtest
cd sgxtest
echo '[target.x86_64-fortanix-unknown-sgx.dependencies.std]' > Xargo.toml
xargo build --target x86_64-fortanix-unknown-sgx
ftxsgx-elf2sgxs target/x86_64-fortanix-unknown-sgx/debug/sgxtest --heap-size 0x20000 --ssaframesize 1 --stack-size 0x20000 --threads 1 --debug
sgxs-append -i target/x86_64-fortanix-unknown-sgx/debug/sgxtest.sgxs
ftxsgx-runner target/x86_64-fortanix-unknown-sgx/debug/sgxtest.sgxs

Centril added a commit to Centril/rust that referenced this issue Dec 24, 2018
Add `std::os::fortanix_sgx` module

This PR adds the `std::os::sgx` module to expose platform-specific APIs behind the `sgx_platform` feature gate.

Depends on rust-lang#56972 to be able to meaningfully build `std::os` documentation for non-standard targets.

Tracking issue: rust-lang#56975
@yonimo
Copy link

yonimo commented Jan 13, 2019

Hi, my name is Yoni Moses and I work for a startup called Fireblocks. We are developing our core technology on SGX, that's why our main language was C++ until now. For a long time we have considered using Rust instead of C++. We've found a number of unofficial modules that tried to adopt Rust to run on SGX platform. However, for us it was amazing news to see that you guys have started to add SGX as an official target for Rust on main repository.
We would like to understand what is the status of the project, do you have any estimation when do you think it will be ready to be merged to stable or release branches? Do you think that it's possible to use it just now? What is your recommendation for using Rust on SGX?

@Centril Centril added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 13, 2019
@jethrogb
Copy link
Contributor Author

jethrogb commented Jan 13, 2019

@yonimo the x86_64-fortanix-unknown-sgx target is a core part of the Fortanix Enclave Development Platform (EDP). The goal of the EDP is to be the best way to write SGX applications (in every way: ease of use, performance, security). It differs significantly from other existing enclave platforms in how you write your application, in that you're not expected to write much (or any) outside-of-the-enclave code. Your enclave starts at Rust's fn main. There's bare-bones instructions at fortanix/rust-sgx#49 on how to use it in the current state. We plan to have a website and documentation out in a week or two. Please give it a try and let me know how it goes! Feel free to contact me on slack as well with any questions - https://fortanix.com/runtime-encryption-slack

@sanxiyn
Copy link
Member

sanxiyn commented Mar 21, 2019

Presumably, the new website is https://edp.fortanix.com/

@jethrogb
Copy link
Contributor Author

Indeed

@jonas-schievink jonas-schievink added the B-unstable Feature: Implemented in the nightly compiler and unstable. label Nov 26, 2019
@KodrAus KodrAus added Libs-Tracked Libs issues that are tracked on the team's project board. O-SGX Target: SGX labels Jul 31, 2020
@nhynes
Copy link
Contributor

nhynes commented Mar 30, 2021

Hello, any update on this? It'd be nice to start using stable Rust after over a year!

@jethrogb
Copy link
Contributor Author

@nhynes Which APIs do you want to use in particular? Just EREPORT/EGETKEY or others as well?

@nhynes
Copy link
Contributor

nhynes commented Mar 30, 2021

Just EREPORT/EGETKEY or others as well?

Yep, those are the ones.

@joshtriplett
Copy link
Member

We discussed this in today's @rust-lang/lang meeting. The only part of this that seems lang-specific is the intrinsics; everything else appears to be the domain of libs.

Of the intrinsics, we were wondering, since we have subsequently shipped asm!, is there substantial value in having intrinsics for SGX-specific instructions, or can we just ask the SGX libraries to use asm! and provide wrappers for that?

@joshtriplett joshtriplett added the S-tracking-design-concerns Status: There are blocking ❌ design concerns. label Jun 8, 2022
@jethrogb
Copy link
Contributor Author

jethrogb commented Jun 8, 2022

Sure, but couldn't you ask the same question of every other intrinsic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Feature: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. Libs-Tracked Libs issues that are tracked on the team's project board. O-SGX Target: SGX S-tracking-design-concerns Status: There are blocking ❌ design concerns. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants