feat(sgxs-tools): Add new sgxs-trace tool#920
Open
jovanbulck wants to merge 1 commit intofortanix:masterfrom
Open
feat(sgxs-tools): Add new sgxs-trace tool#920jovanbulck wants to merge 1 commit intofortanix:masterfrom
jovanbulck wants to merge 1 commit intofortanix:masterfrom
Conversation
`sgxs-trace` extracts SGXS enclaves by tracing the system calls of a running process and intercepting its interactions with the underlying Linux SGX driver. By operating at this level, `sgxs-trace` can extract enclaves in the SGXS format from _any_ program that loads one or more enclaves into its address space. The resulting SGXS files can then be used with `sgxs-tools`, regardless of the SDK or libOS originally used to produce the enclave.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New sgxs-trace tool
sgxs-traceextracts SGXS enclaves by tracing the system calls of a running process and intercepting its interactions with the underlying Linux SGX driver. At this level,sgxs-tracecan extract enclaves in the SGXS format from any program that loads one or more enclaves into its address space, regardless of the SDK or libOS originally used to produce the enclave.Intuitively,
sgxs-tracecan be considered the "inverse" ofsgxs-load: it reconstructs enclaves exactly as they are loaded into memory.This is a from-scratch Rust re-implementation of the C-based sgx-tracer tool.
Use cases
Basically
sgxs-tracemakes it possible to convert enclaves from any runtime/SDK/libOS to the standardized SGXS format.This allows the other
sgxs-toolsutilities to be used more widely beyond EDP only + may help elevating the SGXS format to a platform-independent and SDK-agnostic "middle end" enclave binary format. For instance, bare-sgx now also support SGXS for minimal C enclaves and we have a modified Pandora loader to load SGXS enclave into angr (SGXS support might even be upstreamed to angr at some point).Example
sgxs-traceoperationExample on a sample enclave from the Intel SDK:
Full output below for a minimal bare-sgx enclave.
Compatibility
Tested on various SDKs with the Linux in-kernel
/dev/sgx_enclavedriver, but should be compatible with the older out-of-tree driver as well (through thesgxs-loaderscrate definitions). Since it usesptraceinternally, I guess this is not compatible with Windows.