Replies: 4 comments 4 replies
-
This is a great finding! #1746 should fix your issue. Could you try it out?
We don't/can't use Creating a separate CRT_DRBG context for each thread would be the best option, but I don't know how to do it in a generic case, sounds too complicated. So I opted for a trivial spinlock-based fix. |
Beta Was this translation helpful? Give feedback.
-
Works well, obviously spinlock is better than mutex in this context |
Beta Was this translation helpful? Give feedback.
-
I think we always considered PF code to not be thread safe and the caller was supposed to ensure proper locking, but this issue seems valid despite this - we have a global random seed object which needs locking, because it's shared even between different files. |
Beta Was this translation helpful? Give feedback.
-
This was fixed via #1746, closing this discussion. |
Beta Was this translation helpful? Give feedback.
-
Our project has a data preparation utility for encrypted fs similar to gramine-sgx-pf-crypt, but unlike it, it uses multithreading to speed up the encryption process.
The utility also works without the gramine environment.
The simplified code of the utility can be viewed here
After migrating from Gramine 1.4 to Gramine 1.6, the utility started to crash
Using git bisect, a problematic commit was detected - f186199
This is due to the migration to a new version of mbedtls.
Crash stacktrace:
I fixed the problem with a small fix, but I'm not sure if that's the best way to go about it:
It may be necessary to build mbedtls with the MBEDTLS_THREADING_C option, but I would prefer a lock-free algorithm, such as creating a separate context for each thread. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions