-
Notifications
You must be signed in to change notification settings - Fork 204
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
Host process becomes a zombie when calling execve from another than the initial thread #1265
Comments
Do I understand correctly that the problem is that the This is probably because Gramine forgets to "keep" some important metadata that was somehow stored in the main thread but not in any child thread. Looks like some bug in signal dispositions. I'll take a look at it. P.S. This is the most contrived program I've seen in my life :) |
It responds to signals if I use I'm not so familiar with Gramine's codebase. My assumption was that from the host's perspective, something like this happens: void* f(void* p) {
for (;;) {
sleep(1);
}
}
int main() {
pthread_t t;
pthread_create(&t, NULL, f, NULL);
pthread_exit(0);
} This causes the process to be marked as defunct. (Running the execve example without Gramine doesn't have this behavior.) |
@thomasten Thanks for the hints! I see the problem now. The issue is that from the Linux host perspective, the main thread (with its This happens because Gramine doesn't "rewire" the So I see two solutions:
|
Is it a requirement that the main thread of the enclave process is executed by the main thread of the host process? If not, a third option could be to use the host process's main thread for something else than enclave execution (not sure if Gramine has any mandatory helper threads) or let it wait forever. |
I found the related Linux code: https://elixir.bootlin.com/linux/latest/source/fs/exec.c#L1077 (until line 1155) I don't think that this can map in any way to Gramine, because there is no such syscall as to "rewire" a non-main thread to assume the identity of the main thread (mainly, PID and some other IDs). |
Ok, after some tests and talking with @boryspoplawski I think I understand the issue. Regarding the solutions:
|
@thomasten Could you check #1268? |
I tested the fix with my actual use case. Works fine. |
Description of the problem
I have the following program:
When I run this with Gramine, the host process becomes a zombie:
I think this is because the execve implementation kills all other threads and the initial thread is gone.
Steps to reproduce
No response
Expected results
No response
Actual results
No response
Gramine commit hash
v1.4
The text was updated successfully, but these errors were encountered: