Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: src/core/SkMSAN.h

Issue 1665823002: Hack together MSAN build. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: abstract away Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMSAN.h
diff --git a/src/core/SkMSAN.h b/src/core/SkMSAN.h
index 7e544778d7655cbb2ee6de19565054c7a4cae579..1f32e5356c6f34d9b852635d8f0258eaeea7cbd8 100644
--- a/src/core/SkMSAN.h
+++ b/src/core/SkMSAN.h
@@ -8,11 +8,12 @@
#ifndef SkMSAN_DEFINED
#define SkMSAN_DEFINED
-#include <stddef.h> // size_t
+#include "SkTypes.h"
// Typically declared in LLVM's msan_interface.h. Easier for us to just re-declare.
extern "C" {
void __msan_check_mem_is_initialized(const volatile void*, size_t);
+ void __msan_unpoison (const volatile void*, size_t);
}
// Code that requires initialized inputs can call this to make it clear that
@@ -25,4 +26,15 @@ static inline void sk_msan_assert_initialized(const void* begin, const void* end
#endif
}
+// Lie to MSAN that this range of memory is initialized.
+// This can hide serious problems if overused. Every use of this should refer to a bug.
+static inline void sk_msan_mark_initialized(const void* begin, const void* end, const char* skbug) {
+ SkASSERT(skbug && 0 != strcmp(skbug, ""));
+#if defined(__has_feature)
+ #if __has_feature(memory_sanitizer)
+ __msan_unpoison(begin, (const char*)end - (const char*)begin);
+ #endif
+#endif
+}
+
#endif//SkMSAN_DEFINED
« no previous file with comments | « no previous file | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698