Commit a12a2a09 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

enable FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER macro in ASAN

Summary:
It's common to use UBSAN with ASAN at the same time, and we'll merge them eventually too. As a result we can check for ASAN defined macros to conditionally compile code for UBSAN.

We still have a few build modes that use standalone UBSAN, and unlike other sanitizers, UBSAN doesn't define a magic macro that we could use. In the past we added UNDEFINED_SANITIZER to our compiler flags, but I'd like to go away from it towards a more standard solution (eg check for ASAN).

Reviewed By: yfeldblum, luciang

Differential Revision: D6931054

fbshipit-source-id: 4b298d1cd72cecd693bf99eda309568ef019c544
parent 4e5b3630
...@@ -108,22 +108,12 @@ ...@@ -108,22 +108,12 @@
#define FOLLY_SANITIZE 1 #define FOLLY_SANITIZE 1
#endif #endif
/** #if FOLLY_SANITIZE
* ASAN/MSAN/TSAN define pre-processor symbols:
* ADDRESS_SANITIZER/MEMORY_SANITIZER/THREAD_SANITIZER.
*
* UBSAN doesn't define anything and makes it hard to
* conditionally compile.
*
* The build system should define UNDEFINED_SANITIZER=1 when UBSAN is
* used as folly whitelists some functions.
*/
#if UNDEFINED_SANITIZER
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) \ #define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) \
__attribute__((no_sanitize(__VA_ARGS__))) __attribute__((no_sanitize(__VA_ARGS__)))
#else #else
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) #define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...)
#endif // UNDEFINED_SANITIZER #endif // FOLLY_SANITIZE
/** /**
* Macro for marking functions as having public visibility. * Macro for marking functions as having public visibility.
......
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