intel / intel/confidential-computing.sgx.sdk

TCS pointer becomes misaligned during OCALL

Open
#95 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

We have an application using sgx_2.11 on RHEL 8.4. There is an OCALL which calls a web service and passes the response back into the enclave.

```
int ocall_httpRequest(
[in, string] const char *url,
[in, string] const char *body,
[in, string] const char *host,
int port,
int ssl,
int httpPost,
[in, string] const char *headers,
[out, size=responseSize] char *response,
size_t responseSize,
[out, count=1] int *statusCode);
```

A single line change in one of the functions used in this OCALL causes the enclave to exit. On my dev system in simulation mode I get this message:

`[_SE3 u_instructions.cpp:236] #GP on u_instructions.cpp, line: 236`

It seems to indicate that the TCS pointer is no longer page-aligned.

https://github.com/intel/linux-sgx/blob/b9b071b54476e93ba21ae4f8dc41394970667cdd/sdk/simulation/uinst/u_instructions.cpp#L235-L236

The OCALL ultimately uses Boost's Beast HTTP library. The one added line is a call of `SSL_set_tlsext_host_name()` to use SNI, as the web service in a new test environment requires it. Without this line the code runs just fine. As soon as it is added the enclave exits when the OCALL returns.

I am trying to understand what is causing this and whether we can avoid it by modifying our code somehow. Or is it possibly a bug in sgx_2.11?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.