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

[PAL/Linux-SGX] Read exitless-OCALL result before resetting the stack #1955

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pal/src/host/linux-sgx/enclave_ocalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ static long sgx_exitless_ocall(uint64_t code, void* ocall_args) {
}
}

/* important to copy req->result before resetting the stack, otherwise it may be overwritten;
* this enclave's stack is also used in AEX flows, see host_entry.S:async_exit_pointer() */
long result = COPY_UNTRUSTED_VALUE(&req->result);
sgx_reset_ustack(old_ustack);
return COPY_UNTRUSTED_VALUE(&req->result);

return result;
}

__attribute_no_sanitize_address
Expand Down