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

Dynamic memory allocation for enclaves running on SGXv2 processors #83927

Closed
wants to merge 3 commits into from

Conversation

raoulstrackx
Copy link
Contributor

@raoulstrackx raoulstrackx commented Apr 6, 2021

Intel SGX enclaves running on processors with only SGXv1 extensions, need to reserve all enclave memory they possibly need at enclave creation time. This requires enclave developers to estimate the worst case memory consumption and oversubscribe EPC memory.
On processors with SGXv2 extensions, enclaves may request/release enclave memory dynamically (i.e., after the enclave was created). Changes to enclave memory need to be tracked by both the enclave as the enclave runtime system (untrusted enclave runner, OS, SGX driver). This PR adds the required support for such enclaves. Changes are to the enclave runner and other closely related crates are made in: fortanix/rust-sgx#292.

cc: @jethrogb

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 6, 2021
@@ -96,6 +96,10 @@ cargo = { path = "src/tools/cargo" }
rustfmt-nightly = { path = "src/tools/rustfmt" }

[patch.crates-io]
fortanix-sgx-abi = { git = "https://github.com/fortanix/rust-sgx", branch = "raoul/edmm" }
sgx-isa = { git = "https://github.com/fortanix/rust-sgx", branch = "raoul/edmm" }
bitflags = { git = "https://github.com/bitflags/bitflags" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bitflags patch can be removed once a new version is published on crates.io

@@ -96,6 +96,10 @@ cargo = { path = "src/tools/cargo" }
rustfmt-nightly = { path = "src/tools/rustfmt" }

[patch.crates-io]
fortanix-sgx-abi = { git = "https://github.com/fortanix/rust-sgx", branch = "raoul/edmm" }
sgx-isa = { git = "https://github.com/fortanix/rust-sgx", branch = "raoul/edmm" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Patches need to be removed when fortanix/rust-sgx#292 merges

}

#[derive(Debug)]
pub struct BuddyAllocator {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this move to a crate outside the compiler?

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-10 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

################################################################          89.9%
######################################################################## 100.0%
extracting /checkout/obj/build/cache/2021-03-25/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
    Updating git repository `https://github.com/bitflags/bitflags`
    Updating git repository `https://github.com/fortanix/rust-sgx`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
Caused by:
  failed to load source for dependency `fortanix-sgx-abi`
Caused by:
Caused by:
  Unable to update https://github.com/fortanix/rust-sgx?branch=raoul/edmm#4d629550
Caused by:
Caused by:
  object not found - no match for id (4d629550dfa71e6a5830fc914c1c2d40caa677a6); class=Odb (9); code=NotFound (-3)
Build completed unsuccessfully in 0:00:16
make: *** [prepare] Error 1
Makefile:64: recipe for target 'prepare' failed
Command failed. Attempt 2/5:
Command failed. Attempt 2/5:
    Updating git repository `https://github.com/fortanix/rust-sgx`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
Caused by:
  failed to load source for dependency `fortanix-sgx-abi`
Caused by:
Caused by:
  Unable to update https://github.com/fortanix/rust-sgx?branch=raoul/edmm#4d629550
Caused by:
Caused by:
  object not found - no match for id (4d629550dfa71e6a5830fc914c1c2d40caa677a6); class=Odb (9); code=NotFound (-3)
Build completed unsuccessfully in 0:00:00
make: *** [prepare] Error 1
Makefile:64: recipe for target 'prepare' failed
Command failed. Attempt 3/5:
Command failed. Attempt 3/5:
    Updating git repository `https://github.com/fortanix/rust-sgx`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
Caused by:
  failed to load source for dependency `fortanix-sgx-abi`
Caused by:
Caused by:
  Unable to update https://github.com/fortanix/rust-sgx?branch=raoul/edmm#4d629550
Caused by:
Caused by:
  object not found - no match for id (4d629550dfa71e6a5830fc914c1c2d40caa677a6); class=Odb (9); code=NotFound (-3)
Build completed unsuccessfully in 0:00:01
Makefile:64: recipe for target 'prepare' failed
make: *** [prepare] Error 1
Command failed. Attempt 4/5:
Command failed. Attempt 4/5:
    Updating git repository `https://github.com/fortanix/rust-sgx`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
Caused by:
  failed to load source for dependency `fortanix-sgx-abi`
Caused by:
Caused by:
  Unable to update https://github.com/fortanix/rust-sgx?branch=raoul/edmm#4d629550
Caused by:
Caused by:
  object not found - no match for id (4d629550dfa71e6a5830fc914c1c2d40caa677a6); class=Odb (9); code=NotFound (-3)
Build completed unsuccessfully in 0:00:00
make: *** [prepare] Error 1
Makefile:64: recipe for target 'prepare' failed
Command failed. Attempt 5/5:
Command failed. Attempt 5/5:
    Updating git repository `https://github.com/fortanix/rust-sgx`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
Caused by:
  failed to load source for dependency `fortanix-sgx-abi`
Caused by:
Caused by:
  Unable to update https://github.com/fortanix/rust-sgx?branch=raoul/edmm#4d629550
Caused by:
Caused by:
  object not found - no match for id (4d629550dfa71e6a5830fc914c1c2d40caa677a6); class=Odb (9); code=NotFound (-3)
Build completed unsuccessfully in 0:00:00
make: *** [prepare] Error 1
Makefile:64: recipe for target 'prepare' failed
The command has failed after 5 attempts.

@bors
Copy link
Contributor

bors commented Apr 12, 2021

☔ The latest upstream changes (presumably #83776) made this pull request unmergeable. Please resolve the merge conflicts.

@crlf0710 crlf0710 added the O-SGX Target: SGX label May 1, 2021
@crlf0710
Copy link
Member

crlf0710 commented May 1, 2021

Triage: ci can't pass in current form, and there's merge conflict now.

@crlf0710 crlf0710 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2021
@Dylan-DPC-zz Dylan-DPC-zz removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2021
@Dylan-DPC-zz
Copy link

@raoulstrackx any updates?

@bstrie bstrie added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 19, 2021
@crlf0710
Copy link
Member

crlf0710 commented Jun 5, 2021

@raoulstrackx I'm gonna close this due to inactivity. Feel free to reopen or create a new pr when you're ready to work on this again. Thanks!

@crlf0710 crlf0710 closed this Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-SGX Target: SGX S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants