[PATCH] D26956: Initial changes for porting libFuzzer to Windows.

Marcos Pividori via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 13:10:05 PST 2016


mpividori added inline comments.


================
Comment at: lib/Fuzzer/FuzzerUtilWindows.cpp:32
+LONG WINAPI SEGVHandler(PEXCEPTION_POINTERS ExceptionInfo) {
+  switch (ExceptionInfo->ExceptionRecord->ExceptionCode) {
+    case EXCEPTION_ACCESS_VIOLATION:
----------------
rnk wrote:
> I think it would be better to draw this interface boundary at a higher level. Something where we pass in the handle_* flags, install a single exception handler, have one switch, and let it dispatch based on whether it's supposed to catch that type of exception. Then the cross-platform API would be something like InitializeSignalHandlers().
> 
> This would require hosting the Flags code out of FuzzerDriver.cpp, so we should ask @kcc about it.
Hi, thanks for your comment.
I don't see the real advantage of that. Do you see any problem in registering many exception handlers with `AddVectoredExceptionHandler()`?
Is it only about the design?
Thanks


================
Comment at: lib/Fuzzer/FuzzerUtilWindows.cpp:148
+void SetSigTermHandler() {
+  if (!SetConsoleCtrlHandler(TERMHandler, TRUE)) {
+    DWORD LastError = GetLastError();
----------------
rnk wrote:
> For example, this handler is completely redundant with the SigInt handler. Only one will actually be called.
I am not sure I understand what you mean. The handlers `TERMHandler` and `INTHandler` return a boolean value TRUE or FALSE, to know if they have handled the signal. We can register many handlers.


Repository:
  rL LLVM

https://reviews.llvm.org/D26956





More information about the llvm-commits mailing list