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

Side by Side 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, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMSAN_DEFINED 8 #ifndef SkMSAN_DEFINED
9 #define SkMSAN_DEFINED 9 #define SkMSAN_DEFINED
10 10
11 #include <stddef.h> // size_t 11 #include "SkTypes.h"
12 12
13 // Typically declared in LLVM's msan_interface.h. Easier for us to just re-decl are. 13 // Typically declared in LLVM's msan_interface.h. Easier for us to just re-decl are.
14 extern "C" { 14 extern "C" {
15 void __msan_check_mem_is_initialized(const volatile void*, size_t); 15 void __msan_check_mem_is_initialized(const volatile void*, size_t);
16 void __msan_unpoison (const volatile void*, size_t);
16 } 17 }
17 18
18 // Code that requires initialized inputs can call this to make it clear that 19 // Code that requires initialized inputs can call this to make it clear that
19 // the blame for use of uninitialized data belongs further up the call stack. 20 // the blame for use of uninitialized data belongs further up the call stack.
20 static inline void sk_msan_assert_initialized(const void* begin, const void* end ) { 21 static inline void sk_msan_assert_initialized(const void* begin, const void* end ) {
21 #if defined(__has_feature) 22 #if defined(__has_feature)
22 #if __has_feature(memory_sanitizer) 23 #if __has_feature(memory_sanitizer)
23 __msan_check_mem_is_initialized(begin, (const char*)end - (const char*)b egin); 24 __msan_check_mem_is_initialized(begin, (const char*)end - (const char*)b egin);
24 #endif 25 #endif
25 #endif 26 #endif
26 } 27 }
27 28
29 // Lie to MSAN that this range of memory is initialized.
30 // This can hide serious problems if overused. Every use of this should refer t o a bug.
31 static inline void sk_msan_mark_initialized(const void* begin, const void* end, const char* skbug) {
32 SkASSERT(skbug && 0 != strcmp(skbug, ""));
33 #if defined(__has_feature)
34 #if __has_feature(memory_sanitizer)
35 __msan_unpoison(begin, (const char*)end - (const char*)begin);
36 #endif
37 #endif
38 }
39
28 #endif//SkMSAN_DEFINED 40 #endif//SkMSAN_DEFINED
OLDNEW
« 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