-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix cloning of /dev/tpmrm0 fds on fork #134
Comments
I guess opening and closing the ESYS_CONTEXT surrounding any low-level Esys_* call will be the only way here. |
Or we go ahead and memorize our pid and check it before every Esys_* call. |
Also related to tpm2-software/tpm2-tss#2914 |
@AndreasFuchsTPM And how about locking access to the ESYS_CONTEXT as suggested in another thread? I implemented it in the https://github.com/tpm2-software/tpm2-openssl/tree/threads branch. |
The big question is: Does this lock span over multiple processes ? |
@AndreasFuchsTPM True. I reworked the patch to semaphores. |
Fixed by 775311a |
Related to #130 and #118
There seems to be a problem that Apache (from #130) and NGINX (tested by me) just duplicate the whole context for their worker threads.
This leads to the case where the Esys_Context and specifically the embedded tcti and its opened fds will be accessed from several threads. This leads to confusion inside the kernel indicated by -EBUSY and subsequently some Esys_BAD_SEQUENCE errors.
The only workaround for the moment is to set thread_pool default threads=1; for NGINX (similar for apache).
One solution that comes to my mind for the moment is to introduce a global mutex (that survives the forking) to guard all Esys_* calls.
Or we need to move the Esys_Initialize until after the fork of NGINX.
I wonder and have no idea, when in the sequence of tpm2-openssl commands the fork() from NGINX happens.
Does anyone know ?
The text was updated successfully, but these errors were encountered: