llvm-project
bb6c5944 - [libFuzzer] Use TerminateProcess for immediate exits on Windows (#247877)

Commit
17 hours ago
[libFuzzer] Use TerminateProcess for immediate exits on Windows (#247877) On Windows, `_Exit()` calls `ExitProcess()`, which kills all other threads and then runs `DllMain(DLL_PROCESS_DETACH)` for every loaded DLL while holding the loader lock. libFuzzer often exits from a non-main thread (timeout, RSS limit, or crash handler). If a DLL's detach handler waits on a lock or a thread that was already killed, the process hangs instead of exiting. We saw this on ClusterFuzz after `SUMMARY: libFuzzer: timeout`. Add `ExitImmediately()`, which uses `TerminateProcess()` on Windows to skip DLL detach, the same way as `internal__exit()` in sanitizer_common. Other platforms still use `_Exit()`. Use it for all existing `_Exit()` calls in libFuzzer. Assisted-by: Gemini
Author
Parents
Loading