[fuzzer] Add Windows Visual C++ exception intercept
authorJoe Pletcher <jopletch@microsoft.com>
Thu, 12 Nov 2020 20:37:35 +0000 (12:37 -0800)
committerJonathan Metzman <metzman@chromium.org>
Thu, 12 Nov 2020 21:11:14 +0000 (13:11 -0800)
commitf897e82bfd86099a5321e3fd50c63598e11e289b
treed3b8869e06c499ace5d0e9e26acaa921bdf4f609
parent6c516cda39745ddb931165caadf52911d7ea0f96
[fuzzer] Add Windows Visual C++ exception intercept

Adds a new option, `handle_winexcept` to try to intercept uncaught
Visual C++ exceptions on Windows. On Linux, such exceptions are handled
implicitly by `std::terminate()` raising `SIBABRT`. This option brings the
Windows behavior in line with Linux.

Unfortunately this exception code is intentionally undocumented, however
has remained stable for the last decade. More information can be found
here: https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273

Reviewed By: morehouse, metzman

Differential Revision: https://reviews.llvm.org/D89755
compiler-rt/lib/fuzzer/FuzzerDriver.cpp
compiler-rt/lib/fuzzer/FuzzerFlags.def
compiler-rt/lib/fuzzer/FuzzerOptions.h
compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
compiler-rt/test/fuzzer/UncaughtException.cpp [new file with mode: 0644]
compiler-rt/test/fuzzer/uncaught-exception.test [new file with mode: 0644]