Переглянути джерело

We do stack walking for this, so don't ASAN

One of the very few cases where ASAN reports a
false positive is in stack walking code, so go
and disable that here.

Edit: Create NO_SANITIZE_ADDRESS macro and use it

This is mostly a matter of removing duplicate attribute definitions
and making a macro that puts it in if needed.
Derek Morris 9 роки тому
батько
коміт
779d569336

+ 8 - 0
lib/Common/CommonDefines.h

@@ -600,6 +600,14 @@
 // #define RECYCLER_MARK_TRACK
 // #define INTERNAL_MEM_PROTECT_HEAP_ALLOC
 
+#define NO_SANITIZE_ADDRESS
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+#undef NO_SANITIZE_ADDRESS
+#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize("address")))
+#endif
+#endif
+
 //----------------------------------------------------------------------------------------------------
 // Disabled features
 //----------------------------------------------------------------------------------------------------

+ 1 - 0
lib/Common/Memory/MarkContext.inl

@@ -46,6 +46,7 @@ bool MarkContext::AddTrackedObject(FinalizableObject * obj)
 #endif
 
 template <bool parallel, bool interior, bool doSpecialMark>
+NO_SANITIZE_ADDRESS
 inline
 void MarkContext::ScanMemory(void ** obj, size_t byteCount)
 {

+ 2 - 0
lib/Common/Memory/Recycler.cpp

@@ -1672,6 +1672,8 @@ Recycler::ExpectStackSkip() const
 
 #pragma warning(push)
 #pragma warning(disable:4731) // 'pointer' : frame pointer register 'register' modified by inline assembly code
+// disable address sanitizer, since it doesn't handle custom stack walks well
+NO_SANITIZE_ADDRESS
 size_t
 Recycler::ScanStack()
 {

+ 1 - 0
lib/Common/Memory/Recycler.inl

@@ -526,6 +526,7 @@ Recycler::ScanObjectInlineInterior(void ** obj, size_t byteCount)
 }
 
 template <bool doSpecialMark>
+NO_SANITIZE_ADDRESS
 inline void
 Recycler::ScanMemoryInline(void ** obj, size_t byteCount)
 {