mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 05:56:08 +00:00

The SigCtx function lazily allocates a ThreadSignalContext, and stores it in the ThreadState. This function may be called by various interceptors and the signal handler itself. If SigCtx itself is interrupted by a signal, then (prior to this fix) there was a possibility of allocating two ThreadSignalContexts. This not only leaks, it fails to deliver the signal to the program's signal handler, as the recorded signal is overwritten by the new ThreadSignalContext. Fix this by using a CAS to swap in the ThreadSignalContext, preventing the race. Add a test for this case. Reviewed By: dvyukov, melver Differential Revision: https://reviews.llvm.org/D140582
Compiler-RT ================================ This directory and its subdirectories contain source code for the compiler support routines. Compiler-RT is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. ================================