diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
| commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
| tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /compiler-rt/lib/msan | |
| parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) | |
Notes
Diffstat (limited to 'compiler-rt/lib/msan')
| -rw-r--r-- | compiler-rt/lib/msan/msan.cpp | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/msan/msan_allocator.cpp | 11 | ||||
| -rw-r--r-- | compiler-rt/lib/msan/msan_blacklist.txt | 3 | ||||
| -rw-r--r-- | compiler-rt/lib/msan/msan_interceptors.cpp | 5 |
4 files changed, 19 insertions, 4 deletions
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp index 6ea63cb2c48f..7095ee1bf20f 100644 --- a/compiler-rt/lib/msan/msan.cpp +++ b/compiler-rt/lib/msan/msan.cpp @@ -122,6 +122,10 @@ class FlagHandlerKeepGoing : public FlagHandlerBase { *halt_on_error_ = !tmp; return true; } + bool Format(char *buffer, uptr size) final { + const char *keep_going_str = (*halt_on_error_) ? "false" : "true"; + return FormatString(buffer, size, keep_going_str); + } }; static void RegisterMsanFlags(FlagParser *parser, Flags *f) { diff --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp index 6aa4e2738075..a08c1a00d2e5 100644 --- a/compiler-rt/lib/msan/msan_allocator.cpp +++ b/compiler-rt/lib/msan/msan_allocator.cpp @@ -115,9 +115,16 @@ static Allocator allocator; static AllocatorCache fallback_allocator_cache; static StaticSpinMutex fallback_mutex; +static uptr max_malloc_size; + void MsanAllocatorInit() { SetAllocatorMayReturnNull(common_flags()->allocator_may_return_null); allocator.Init(common_flags()->allocator_release_to_os_interval_ms); + if (common_flags()->max_allocation_size_mb) + max_malloc_size = Min(common_flags()->max_allocation_size_mb << 20, + kMaxAllowedMallocSize); + else + max_malloc_size = kMaxAllowedMallocSize; } AllocatorCache *GetAllocatorCache(MsanThreadLocalMallocStorage *ms) { @@ -132,12 +139,12 @@ void MsanThreadLocalMallocStorage::CommitBack() { static void *MsanAllocate(StackTrace *stack, uptr size, uptr alignment, bool zeroise) { - if (size > kMaxAllowedMallocSize) { + if (size > max_malloc_size) { if (AllocatorMayReturnNull()) { Report("WARNING: MemorySanitizer failed to allocate 0x%zx bytes\n", size); return nullptr; } - ReportAllocationSizeTooBig(size, kMaxAllowedMallocSize, stack); + ReportAllocationSizeTooBig(size, max_malloc_size, stack); } MsanThread *t = GetCurrentThread(); void *allocated; diff --git a/compiler-rt/lib/msan/msan_blacklist.txt b/compiler-rt/lib/msan/msan_blacklist.txt index 44a5680d4d06..3efef5712185 100644 --- a/compiler-rt/lib/msan/msan_blacklist.txt +++ b/compiler-rt/lib/msan/msan_blacklist.txt @@ -5,3 +5,6 @@ # Example usage: # fun:*bad_function_name* # src:file_with_tricky_code.cc + +# https://bugs.llvm.org/show_bug.cgi?id=31877 +fun:__gxx_personality_* diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp index 1d9d9f7986d7..1c6956eca0f6 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cpp +++ b/compiler-rt/lib/msan/msan_interceptors.cpp @@ -1070,8 +1070,9 @@ INTERCEPTOR(int, pthread_key_create, __sanitizer_pthread_key_t *key, } #if SANITIZER_NETBSD -INTERCEPTOR(void, __libc_thr_keycreate, void *m, void (*dtor)(void *value)) \ - ALIAS(WRAPPER_NAME(pthread_key_create)); +INTERCEPTOR(int, __libc_thr_keycreate, __sanitizer_pthread_key_t *m, + void (*dtor)(void *value)) +ALIAS(WRAPPER_NAME(pthread_key_create)); #endif INTERCEPTOR(int, pthread_join, void *th, void **retval) { |
