Commit d15d9f55 authored by John Kearney's avatar John Kearney Committed by Facebook GitHub Bot

Allow folly fibers to compile with windows asan

Summary:
- Folly FiberManager makes the assumption that asan always has dlfcn.h
   available.
   - This assumption is not true on windows.
 - This diff would mean that windows asan would not use:
   - `__sanitizer_start_switch_fiber`
   - `__sanitizer_finish_switch_fiber`
   - `__asan_unpoison_memory_region`
 - The behavior of `GetProcAddress` on windows is sufficiently different to `dlsym` to make switching to it without significant testing unappealing.

(Note: this ignores all push blocking failures!)

Reviewed By: andriigrynenko

Differential Revision: D24167183

fbshipit-source-id: 2587a4000901b5e3a8857e9aa5816270d2be34dc
parent b984cc9d
......@@ -35,7 +35,9 @@
#ifdef FOLLY_SANITIZE_ADDRESS
#ifndef _WIN32
#include <dlfcn.h>
#endif
static void __sanitizer_start_switch_fiber_weak(
void** fake_stack_save,
......@@ -280,11 +282,13 @@ static AsanStartSwitchStackFuncPtr getStartSwitchStackFunc() {
}
// Check whether we can find a dynamically linked enter function
#ifndef _WIN32
if (nullptr !=
(fn = (AsanStartSwitchStackFuncPtr)dlsym(
RTLD_DEFAULT, "__sanitizer_start_switch_fiber"))) {
return fn;
}
#endif
// Couldn't find the function at all
return nullptr;
......@@ -299,11 +303,13 @@ static AsanFinishSwitchStackFuncPtr getFinishSwitchStackFunc() {
}
// Check whether we can find a dynamically linked exit function
#ifndef _WIN32
if (nullptr !=
(fn = (AsanFinishSwitchStackFuncPtr)dlsym(
RTLD_DEFAULT, "__sanitizer_finish_switch_fiber"))) {
return fn;
}
#endif
// Couldn't find the function at all
return nullptr;
......@@ -318,11 +324,13 @@ static AsanUnpoisonMemoryRegionFuncPtr getUnpoisonMemoryRegionFunc() {
}
// Check whether we can find a dynamically linked unpoison function
#ifndef _WIN32
if (nullptr !=
(fn = (AsanUnpoisonMemoryRegionFuncPtr)dlsym(
RTLD_DEFAULT, "__asan_unpoison_memory_region"))) {
return fn;
}
#endif
// Couldn't find the function at all
return nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment