-
Notifications
You must be signed in to change notification settings - Fork 16
Rewrite the SGX backend as an elf loader #478
Conversation
Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
This makes it easier to reason about. Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
This makes it clearer where the actual entrypoint into the program is. Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
|
||
/// This segment contains unmeasured pages. | ||
#[cfg(feature = "backend-sgx")] | ||
pub const PF_ENARX_SGX_UNMEASURED: u32 = 1 << 21; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used in the linker script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't (yet?). But I want it well defined in case we choose to use this strategy in the shim in the future. That way it won't require a new server side. Only client side changes will be required.
code.region().into(), | ||
); | ||
// Find the offset for loading the code. | ||
let slot = Span::from(shim.find_header(PT_ENARX_CODE).unwrap().vm_range()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an anyhow context to the error and return with ?
instead of unwrap()
. This makes debugging a little bit easier.
Same for the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that now. However, my next change is to pull out the common behavior between the backends and make the Backend
API more intelligent. This was going to include better error handling processes. Do you want to wait for that? Or do you want me to improve error handling now?
This is defensive in case the host manages to resume the enclave during an exit() syscall. If so, this syscall will be repeated endlessly. Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
This matches the behavior under kvm. Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
Signed-off-by: Nathaniel McCallum <nathaniel@congru.us>
tcs0 PT_LOAD FLAGS(1 << 20); /* PF_ENARX_SGX_TCS */ | ||
ssa0 PT_LOAD; | ||
|
||
exec 0x634A0003 FLAGS(0); /* PT_ENARX_EXEC */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PT_ENARX_EXEC
or PT_ENARX_CODE
or PT_ENARX_INIT
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose we rename the "code" layer to the executable or "exec" layer.
Merge these first: