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

ltp epoll_wait01 fail in gramine-sgx #2069

Open
LeoneChen opened this issue Nov 22, 2024 · 1 comment
Open

ltp epoll_wait01 fail in gramine-sgx #2069

LeoneChen opened this issue Nov 22, 2024 · 1 comment

Comments

@LeoneChen
Copy link

LeoneChen commented Nov 22, 2024

Description of the problem

image

In epoll_wait01, setup will firstly create pipe, and in get_writesize, write n * 4096 bytes to pipe and then read to determine pipe wirtable size.
1732258585920

However, in gramine-sgx, pipe is implemented by socket, and mbedtls is used to encrypt data, i.e. mbedtls_ssl_write used to encrypt data to write and mbedtls_ssl_read used to decrypt data to read.

Each time in SAFE_WRITE (4096 bytes), mbedtls_ssl_write treat it as a record (including header and app-level data), thus n record is sent to socket. When read, mbedtls_ssl_read read one record (read header, determine encrypted app-level data size, read app-level data) and then it is able to decrypt and return plaintext data, while other n-1 records are ignored.

I.e. maybe a loop of mbedtls_ssl_read is needed to receive n mbedtls record from socket to successfully mimic pipe behavior, maybe should update lib_SSLRead?

image

Gramine commit hash

8fc123d

@mkow
Copy link
Member

mkow commented Nov 28, 2024

Please don't paste text as screenshots.

Also, from your description I don't see why the test fails. It tries to put a lot of data into the pipe and checks how much of it fit, which will be lower under SGX. But where's the failure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants