-
Notifications
You must be signed in to change notification settings - Fork 193
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] getsockname() get wrong addr and port on unbind SOCK_STREAM socket #500
Comments
@boryspoplawski is fixing the whole subsystem of sockets/networking in Gramine currently. But if your fix is small and contained, then we can review & merge it now, to unblock such workloads. |
Yes, a small one. |
Yes, everything will be fixed (hopefully). The new version will is written from scratch. |
Yes. It fixes issue. |
Description of the problem
I reproduce gramineproject/graphene#2046 on Gramine master using C code instead of Java.
Steps to reproduce
TCP server locate at
10.239.34.5:4433
and TCP client locate at10.239.45.129
Run sample code from https://gist.github.com/listnukira/4045436
Expected results
Actual results
Additional information
getsockname
syscall is called withconnect
in LibOS.getsockname
in LibOS only returns the cached data.As my description in gramineproject/graphene#2046.
The root cause is in Linux-SGX,
bind_addr
is NULL.gramine/Pal/src/host/Linux-SGX/db_sockets.c
Lines 356 to 357 in f0ff094
SGX ocall
ocall_connect
cannot allocate memory in enclave and doesn't callgetsockname
.gramine/Pal/src/host/Linux-SGX/sgx_enclave.c
Lines 453 to 455 in f0ff094
however, Linux pal can work because
bind_addr
reassigned.gramine/Pal/src/host/Linux/db_sockets.c
Lines 460 to 464 in f0ff094
I'll create a PR to fix it.
Gramine commit hash
c56a353
The text was updated successfully, but these errors were encountered: