Commit fb0be74d authored by Taewook Oh's avatar Taewook Oh Committed by Facebook GitHub Bot

folly: define FOLLY_SANITIZE_DATAFLOW macro for DFSan.

Summary: This defines the macro `FOLLY_SANITIZER_DATAFLOW` as other sanitizers do.

Reviewed By: yfeldblum

Differential Revision: D33747374

fbshipit-source-id: 3c8aa58f43ed72c4ca259bd2434e1f79d12dc65b
parent 3e149ff7
...@@ -133,13 +133,30 @@ ...@@ -133,13 +133,30 @@
#define FOLLY_DISABLE_MEMORY_SANITIZER #define FOLLY_DISABLE_MEMORY_SANITIZER
#endif #endif
/**
* Define a convenience macro to test when dataflow sanitizer is being used
* across the different compilers (e.g. clang, gcc)
*/
#ifndef FOLLY_SANITIZE_DATAFLOW
#if FOLLY_HAS_FEATURE(dataflow_sanitizer) || defined(__SANITIZE_DATAFLOW__)
#define FOLLY_SANITIZE_DATAFLOW 1
#endif
#endif
#ifdef FOLLY_SANITIZE_DATAFLOW
#define FOLLY_DISABLE_DATAFLOW_SANITIZER \
__attribute__((no_sanitize_dataflow, noinline))
#else
#define FOLLY_DISABLE_DATAFLOW_SANITIZER
#endif
/** /**
* Define a convenience macro to test when ASAN, UBSAN, TSAN or MSAN sanitizer * Define a convenience macro to test when ASAN, UBSAN, TSAN or MSAN sanitizer
* are being used * are being used
*/ */
#ifndef FOLLY_SANITIZE #ifndef FOLLY_SANITIZE
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD) || \ #if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD) || \
defined(FOLLY_SANITIZE_MEMORY) defined(FOLLY_SANITIZE_MEMORY) || defined(FOLLY_SANITIZE_DATAFLOW)
#define FOLLY_SANITIZE 1 #define FOLLY_SANITIZE 1
#endif #endif
#endif #endif
......
...@@ -149,6 +149,12 @@ constexpr bool kIsSanitizeThread = true; ...@@ -149,6 +149,12 @@ constexpr bool kIsSanitizeThread = true;
constexpr bool kIsSanitizeThread = false; constexpr bool kIsSanitizeThread = false;
#endif #endif
#ifdef FOLLY_SANITIZE_DATAFLOW
constexpr bool kIsSanitizeDataflow = true;
#else
constexpr bool kIsSanitizeDataflow = false;
#endif
#ifdef FOLLY_SANITIZE #ifdef FOLLY_SANITIZE
constexpr bool kIsSanitize = true; constexpr bool kIsSanitize = true;
#else #else
......
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