-
Notifications
You must be signed in to change notification settings - Fork 13.3k
SGX: Change ELF entrypoint #67084
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
SGX: Change ELF entrypoint #67084
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Kimundi (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
203: elf2sgx: Remove .text_no_sgx section during conversion r=jethrogb a=Pagten This pull request is related to [rust-lang pull request #67084](rust-lang/rust#67084), which places the ELF entry point in a separate section of the ELF file. This pull request removes/overwrites that section during the conversion from ELF to SGXS, because that code is not needed in the enclave. To avoid changing the relative position of other code, the section is only removed if it is at the end of a program segment. It is overwritten with NOPs otherwise. The pull request also includes some general refactoring of the code related to Splices. Co-authored-by: Pieter Agten <pieter.agten@fortanix.com>
r? @Amanieu |
@bors r+ |
📌 Commit f02ffb8 has been approved by |
…r=Amanieu SGX: Change ELF entrypoint This fixes [rust-sgx issue #148](fortanix/rust-sgx#148). A new entry point is created for the ELF file generated by `rustc`, separate from the enclave entry point. When the ELF file is executed as a Linux binary, the error message below is written to stderr. > Error: This file is an SGX enclave which cannot be executed as a standard Linux binary. > See the installation guide at https://edp.fortanix.com/docs/installation/guide/ on how to use 'cargo run' or follow the steps at https://edp.fortanix.com/docs/tasks/deployment/ for manual deployment. When the ELF file is converted to an SGXS using `elf2sgxs`, the old entry point is still set as the enclave entry point. In a future pull request in the rust-sgx repository, `elf2sgxs` will be modified to remove the code in the ELF entry point, since this code is not needed in the enclave.
☀️ Test successful - checks-azure |
This fixes rust-sgx issue #148.
A new entry point is created for the ELF file generated by
rustc
, separate from the enclave entry point. When the ELF file is executed as a Linux binary, the error message below is written to stderr.When the ELF file is converted to an SGXS using
elf2sgxs
, the old entry point is still set as the enclave entry point. In a future pull request in the rust-sgx repository,elf2sgxs
will be modified to remove the code in the ELF entry point, since this code is not needed in the enclave.