Commit 7b82832d authored by David Rothera's avatar David Rothera Committed by Facebook Github Bot

Define macro for disabling thread and address sanitizer and use on range SSE methods

Summary: [folly] Define macro for disabling thread sanitizer and use on range SSE methods

Reviewed By: yfeldblum, pixelb

Differential Revision: D13192417

fbshipit-source-id: 23774f8e0227c4c557d51f557b4df5e79f641386
parent 79c28f03
...@@ -105,6 +105,13 @@ ...@@ -105,6 +105,13 @@
#define FOLLY_SANITIZE_THREAD 1 #define FOLLY_SANITIZE_THREAD 1
#endif #endif
#if FOLLY_SANITIZE_THREAD
#define FOLLY_DISABLE_THREAD_SANITIZER \
__attribute__((no_sanitize_thread, noinline))
#else
#define FOLLY_DISABLE_THREAD_SANITIZER
#endif
/** /**
* Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are * Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are
* being used * being used
...@@ -120,6 +127,10 @@ ...@@ -120,6 +127,10 @@
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) #define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...)
#endif // FOLLY_SANITIZE #endif // FOLLY_SANITIZE
#define FOLLY_DISABLE_SANITIZERS \
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_THREAD_SANITIZER \
FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER("undefined")
/** /**
* Macro for marking functions as having public visibility. * Macro for marking functions as having public visibility.
*/ */
......
...@@ -21,13 +21,11 @@ namespace detail { ...@@ -21,13 +21,11 @@ namespace detail {
#if FOLLY_SSE_PREREQ(2, 0) #if FOLLY_SSE_PREREQ(2, 0)
FOLLY_DISABLE_ADDRESS_SANITIZER __m128i FOLLY_DISABLE_SANITIZERS __m128i _mm_loadu_si128_nosan(__m128i const* const p) {
_mm_loadu_si128_noasan(__m128i const* const p) {
return _mm_loadu_si128(p); return _mm_loadu_si128(p);
} }
FOLLY_DISABLE_ADDRESS_SANITIZER __m128i FOLLY_DISABLE_SANITIZERS __m128i _mm_load_si128_nosan(__m128i const* const p) {
_mm_load_si128_noasan(__m128i const* const p) {
return _mm_load_si128(p); return _mm_load_si128(p);
} }
......
...@@ -29,16 +29,16 @@ namespace detail { ...@@ -29,16 +29,16 @@ namespace detail {
#if FOLLY_SSE_PREREQ(2, 0) #if FOLLY_SSE_PREREQ(2, 0)
__m128i _mm_loadu_si128_noasan(__m128i const* const p); __m128i _mm_loadu_si128_nosan(__m128i const* const p);
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN __m128i FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN __m128i
_mm_loadu_si128_unchecked(__m128i const* const p) { _mm_loadu_si128_unchecked(__m128i const* const p) {
return kIsSanitizeAddress ? _mm_loadu_si128_noasan(p) : _mm_loadu_si128(p); return kIsSanitize ? _mm_loadu_si128_nosan(p) : _mm_loadu_si128(p);
} }
__m128i _mm_load_si128_noasan(__m128i const* const p); __m128i _mm_load_si128_nosan(__m128i const* const p);
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN __m128i FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN __m128i
_mm_load_si128_unchecked(__m128i const* const p) { _mm_load_si128_unchecked(__m128i const* const p) {
return kIsSanitizeAddress ? _mm_load_si128_noasan(p) : _mm_load_si128(p); return kIsSanitize ? _mm_load_si128_nosan(p) : _mm_load_si128(p);
} }
#endif #endif
......
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