Hi community members,
Happy new year!
I am developing a service that runs JIT to serve the request per thread. Each thread has a standalone MCJIT instance using its own memory manager, resolver, and others.
What i find out is that without lock, MCJIT can generate incorrect EH_FRAME for exception handling. When one request is throwing and doing unwinding, its undwinder cannot go through the call stack correctly. I am using the default libgcc undwinder and I can see in GDB that the search phrase of unwind can fail. It is not always failing so I assume that there is some data racing there.
When I serialize the MCJIT finalizeObject() using a global lock the issue is gone. I can verify that the EH_FRAME is different in bytes when there is a lock and there is not.
Can anyone give pointers on why that can happen? I can see that MCJIT finalizeObject() is doing a bunch of things, but I find hard to see how the lock is needed? (symbol resolution, relocation?).
I am using LLVM 7.0.