diff options
-rw-r--r-- | include/sanitizer/asan_interface.h | 49 | ||||
-rw-r--r-- | include/sanitizer/msan_interface.h | 54 | ||||
-rw-r--r-- | lib/asan/asan_allocator2.cc | 18 | ||||
-rw-r--r-- | lib/asan/asan_interface_internal.h | 16 | ||||
-rw-r--r-- | lib/asan/asan_internal.h | 2 | ||||
-rw-r--r-- | lib/asan/asan_rtl.cc | 7 | ||||
-rw-r--r-- | lib/asan/asan_stats.cc | 12 | ||||
-rw-r--r-- | lib/msan/msan.h | 2 | ||||
-rw-r--r-- | lib/msan/msan_allocator.cc | 21 | ||||
-rw-r--r-- | lib/msan/msan_interface_internal.h | 22 | ||||
-rw-r--r-- | lib/tsan/rtl/tsan_mman.cc | 30 | ||||
-rw-r--r-- | test/asan/TestCases/Darwin/interface_symbols_darwin.c | 2 | ||||
-rw-r--r-- | test/asan/TestCases/Linux/interface_symbols_linux.c | 2 |
13 files changed, 0 insertions, 237 deletions
diff --git a/include/sanitizer/asan_interface.h b/include/sanitizer/asan_interface.h index e8163cfc3..db0d1f5d3 100644 --- a/include/sanitizer/asan_interface.h +++ b/include/sanitizer/asan_interface.h @@ -99,46 +99,6 @@ extern "C" { // the program crashes before ASan report is printed. void __asan_on_error(); - // Returns the estimated number of bytes that will be reserved by allocator - // for request of "size" bytes. If ASan allocator can't allocate that much - // memory, returns the maximal possible allocation size, otherwise returns - // "size". - /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead. */ - size_t __asan_get_estimated_allocated_size(size_t size); - - // Returns 1 if p was returned by the ASan allocator and is not yet freed. - // Otherwise returns 0. - /* DEPRECATED: Use __sanitizer_get_ownership instead. */ - int __asan_get_ownership(const void *p); - - // Returns the number of bytes reserved for the pointer p. - // Requires (get_ownership(p) == true) or (p == 0). - /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */ - size_t __asan_get_allocated_size(const void *p); - - // Number of bytes, allocated and not yet freed by the application. - /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */ - size_t __asan_get_current_allocated_bytes(); - - // Number of bytes, mmaped by asan allocator to fulfill allocation requests. - // Generally, for request of X bytes, allocator can reserve and add to free - // lists a large number of chunks of size X to use them for future requests. - // All these chunks count toward the heap size. Currently, allocator never - // releases memory to OS (instead, it just puts freed chunks to free lists). - /* DEPRECATED: Use __sanitizer_get_heap_size instead. */ - size_t __asan_get_heap_size(); - - // Number of bytes, mmaped by asan allocator, which can be used to fulfill - // allocation requests. When a user program frees memory chunk, it can first - // fall into quarantine and will count toward __asan_get_free_bytes() later. - /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */ - size_t __asan_get_free_bytes(); - - // Number of bytes in unmapped pages, that are released to OS. Currently, - // always returns 0. - /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */ - size_t __asan_get_unmapped_bytes(); - // Prints accumulated stats to stderr. Used for debugging. void __asan_print_accumulated_stats(); @@ -146,15 +106,6 @@ extern "C" { // a string containing ASan runtime options. See asan_flags.h for details. const char* __asan_default_options(); - // Malloc hooks that may be optionally provided by user. - // __asan_malloc_hook(ptr, size) is called immediately after - // allocation of "size" bytes, which returned "ptr". - // __asan_free_hook(ptr) is called immediately before - // deallocation of "ptr". - /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook instead. */ - void __asan_malloc_hook(void *ptr, size_t size); - void __asan_free_hook(void *ptr); - // The following 2 functions facilitate garbage collection in presence of // asan's fake stack. diff --git a/include/sanitizer/msan_interface.h b/include/sanitizer/msan_interface.h index f6a62be5c..5be586047 100644 --- a/include/sanitizer/msan_interface.h +++ b/include/sanitizer/msan_interface.h @@ -93,60 +93,6 @@ extern "C" { Passing 0 will unset the callback. */ void __msan_set_death_callback(void (*callback)(void)); - /***********************************/ - /* Allocator statistics interface. */ - - /* Returns the estimated number of bytes that will be reserved by allocator - for request of "size" bytes. If Msan allocator can't allocate that much - memory, returns the maximal possible allocation size, otherwise returns - "size". */ - /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead. */ - size_t __msan_get_estimated_allocated_size(size_t size); - - /* Returns true if p was returned by the Msan allocator and - is not yet freed. */ - /* DEPRECATED: Use __sanitizer_get_ownership instead. */ - int __msan_get_ownership(const volatile void *p); - - /* Returns the number of bytes reserved for the pointer p. - Requires (get_ownership(p) == true) or (p == 0). */ - /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */ - size_t __msan_get_allocated_size(const volatile void *p); - - /* Number of bytes, allocated and not yet freed by the application. */ - /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */ - size_t __msan_get_current_allocated_bytes(); - - /* Number of bytes, mmaped by msan allocator to fulfill allocation requests. - Generally, for request of X bytes, allocator can reserve and add to free - lists a large number of chunks of size X to use them for future requests. - All these chunks count toward the heap size. Currently, allocator never - releases memory to OS (instead, it just puts freed chunks to free - lists). */ - /* DEPRECATED: Use __sanitizer_get_heap_size instead. */ - size_t __msan_get_heap_size(); - - /* Number of bytes, mmaped by msan allocator, which can be used to fulfill - allocation requests. When a user program frees memory chunk, it can first - fall into quarantine and will count toward __msan_get_free_bytes() - later. */ - /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */ - size_t __msan_get_free_bytes(); - - /* Number of bytes in unmapped pages, that are released to OS. Currently, - always returns 0. */ - /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */ - size_t __msan_get_unmapped_bytes(); - - /* Malloc hooks that may be optionally provided by user. - __msan_malloc_hook(ptr, size) is called immediately after - allocation of "size" bytes, which returned "ptr". - __msan_free_hook(ptr) is called immediately before - deallocation of "ptr". */ - /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook instead. */ - void __msan_malloc_hook(const volatile void *ptr, size_t size); - void __msan_free_hook(const volatile void *ptr); - #ifdef __cplusplus } // extern "C" #endif diff --git a/lib/asan/asan_allocator2.cc b/lib/asan/asan_allocator2.cc index fc626a733..27c25cfa5 100644 --- a/lib/asan/asan_allocator2.cc +++ b/lib/asan/asan_allocator2.cc @@ -757,17 +757,11 @@ using namespace __asan; // NOLINT uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; } -uptr __asan_get_estimated_allocated_size(uptr size) { - return __sanitizer_get_estimated_allocated_size(size); -} int __sanitizer_get_ownership(const void *p) { uptr ptr = reinterpret_cast<uptr>(p); return (AllocationSize(ptr) > 0); } -int __asan_get_ownership(const void *p) { - return __sanitizer_get_ownership(p); -} uptr __sanitizer_get_allocated_size(const void *p) { if (p == 0) return 0; @@ -780,23 +774,11 @@ uptr __sanitizer_get_allocated_size(const void *p) { } return allocated_size; } -uptr __asan_get_allocated_size(const void *p) { - return __sanitizer_get_allocated_size(p); -} #if !SANITIZER_SUPPORTS_WEAK_HOOKS // Provide default (no-op) implementation of malloc hooks. extern "C" { SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void __asan_malloc_hook(void *ptr, uptr size) { - (void)ptr; - (void)size; -} -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void __asan_free_hook(void *ptr) { - (void)ptr; -} -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void __sanitizer_malloc_hook(void *ptr, uptr size) { (void)ptr; (void)size; diff --git a/lib/asan/asan_interface_internal.h b/lib/asan/asan_interface_internal.h index e7639e107..6f34ce65b 100644 --- a/lib/asan/asan_interface_internal.h +++ b/lib/asan/asan_interface_internal.h @@ -115,22 +115,6 @@ extern "C" { SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE /* OPTIONAL */ void __asan_on_error(); - // --------------------------- - // FIXME: Replace these functions with __sanitizer equivalent. - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_estimated_allocated_size(uptr size); - SANITIZER_INTERFACE_ATTRIBUTE int __asan_get_ownership(const void *p); - SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_allocated_size(const void *p); - SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_current_allocated_bytes(); - SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_heap_size(); - SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_free_bytes(); - SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_unmapped_bytes(); - SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE - /* OPTIONAL */ void __asan_malloc_hook(void *ptr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE - /* OPTIONAL */ void __asan_free_hook(void *ptr); - // --------------------------- - SANITIZER_INTERFACE_ATTRIBUTE void __asan_print_accumulated_stats(); SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE diff --git a/lib/asan/asan_internal.h b/lib/asan/asan_internal.h index 1c18bd865..798d687b8 100644 --- a/lib/asan/asan_internal.h +++ b/lib/asan/asan_internal.h @@ -108,10 +108,8 @@ bool PlatformHasDifferentMemcpyAndMemmove(); // Add convenient macro for interface functions that may be represented as // weak hooks. #define ASAN_MALLOC_HOOK(ptr, size) \ - if (&__asan_malloc_hook) __asan_malloc_hook(ptr, size); \ if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size) #define ASAN_FREE_HOOK(ptr) \ - if (&__asan_free_hook) __asan_free_hook(ptr); \ if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr) #define ASAN_ON_ERROR() \ if (&__asan_on_error) __asan_on_error() diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index 9a268f41d..bf3aa74fe 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -468,13 +468,6 @@ static NOINLINE void force_interface_symbols() { case 15: __asan_set_error_report_callback(0); break; case 16: __asan_handle_no_return(); break; case 17: __asan_address_is_poisoned(0); break; - case 18: __asan_get_allocated_size(0); break; - case 19: __asan_get_current_allocated_bytes(); break; - case 20: __asan_get_estimated_allocated_size(0); break; - case 21: __asan_get_free_bytes(); break; - case 22: __asan_get_heap_size(); break; - case 23: __asan_get_ownership(0); break; - case 24: __asan_get_unmapped_bytes(); break; case 25: __asan_poison_memory_region(0, 0); break; case 26: __asan_unpoison_memory_region(0, 0); break; case 27: __asan_set_error_exit_code(0); break; diff --git a/lib/asan/asan_stats.cc b/lib/asan/asan_stats.cc index 0837bc8d6..a78b7b1e9 100644 --- a/lib/asan/asan_stats.cc +++ b/lib/asan/asan_stats.cc @@ -149,18 +149,12 @@ uptr __sanitizer_get_current_allocated_bytes() { // way we update accumulated stats. return (malloced > freed) ? malloced - freed : 1; } -uptr __asan_get_current_allocated_bytes() { - return __sanitizer_get_current_allocated_bytes(); -} uptr __sanitizer_get_heap_size() { AsanStats stats; GetAccumulatedStats(&stats); return stats.mmaped - stats.munmaped; } -uptr __asan_get_heap_size() { - return __sanitizer_get_heap_size(); -} uptr __sanitizer_get_free_bytes() { AsanStats stats; @@ -175,16 +169,10 @@ uptr __sanitizer_get_free_bytes() { // way we update accumulated stats. return (total_free > total_used) ? total_free - total_used : 1; } -uptr __asan_get_free_bytes() { - return __sanitizer_get_free_bytes(); -} uptr __sanitizer_get_unmapped_bytes() { return 0; } -uptr __asan_get_unmapped_bytes() { - return __sanitizer_get_unmapped_bytes(); -} void __asan_print_accumulated_stats() { PrintAccumulatedStats(); diff --git a/lib/msan/msan.h b/lib/msan/msan.h index 05a8c476b..7bdb6a57c 100644 --- a/lib/msan/msan.h +++ b/lib/msan/msan.h @@ -141,10 +141,8 @@ void MsanTSDDtor(void *tsd); } // namespace __msan #define MSAN_MALLOC_HOOK(ptr, size) \ - if (&__msan_malloc_hook) __msan_malloc_hook(ptr, size); \ if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size) #define MSAN_FREE_HOOK(ptr) \ - if (&__msan_free_hook) __msan_free_hook(ptr); \ if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr) #endif // MSAN_H diff --git a/lib/msan/msan_allocator.cc b/lib/msan/msan_allocator.cc index fb1788f2a..69492970d 100644 --- a/lib/msan/msan_allocator.cc +++ b/lib/msan/msan_allocator.cc @@ -188,40 +188,19 @@ uptr __sanitizer_get_current_allocated_bytes() { allocator.GetStats(stats); return stats[AllocatorStatAllocated]; } -uptr __msan_get_current_allocated_bytes() { - return __sanitizer_get_current_allocated_bytes(); -} uptr __sanitizer_get_heap_size() { uptr stats[AllocatorStatCount]; allocator.GetStats(stats); return stats[AllocatorStatMapped]; } -uptr __msan_get_heap_size() { - return __sanitizer_get_heap_size(); -} uptr __sanitizer_get_free_bytes() { return 1; } -uptr __msan_get_free_bytes() { - return __sanitizer_get_free_bytes(); -} uptr __sanitizer_get_unmapped_bytes() { return 1; } -uptr __msan_get_unmapped_bytes() { - return __sanitizer_get_unmapped_bytes(); -} uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; } -uptr __msan_get_estimated_allocated_size(uptr size) { - return __sanitizer_get_estimated_allocated_size(size); -} int __sanitizer_get_ownership(const void *p) { return AllocationSize(p) != 0; } -int __msan_get_ownership(const void *p) { - return __sanitizer_get_ownership(p); -} uptr __sanitizer_get_allocated_size(const void *p) { return AllocationSize(p); } -uptr __msan_get_allocated_size(const void *p) { - return __sanitizer_get_allocated_size(p); -} diff --git a/lib/msan/msan_interface_internal.h b/lib/msan/msan_interface_internal.h index 47b47dc4b..21bfbc986 100644 --- a/lib/msan/msan_interface_internal.h +++ b/lib/msan/msan_interface_internal.h @@ -161,28 +161,6 @@ void __sanitizer_unaligned_store32(uu32 *p, u32 x); SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_unaligned_store64(uu64 *p, u64 x); -// --------------------------- -// FIXME: Replace these functions with __sanitizer equivalent. -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_estimated_allocated_size(uptr size); -SANITIZER_INTERFACE_ATTRIBUTE -int __msan_get_ownership(const void *p); -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_allocated_size(const void *p); -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_current_allocated_bytes(); -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_heap_size(); -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_free_bytes(); -SANITIZER_INTERFACE_ATTRIBUTE -uptr __msan_get_unmapped_bytes(); -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -/* OPTIONAL */ void __msan_malloc_hook(void *ptr, uptr size); -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -/* OPTIONAL */ void __msan_free_hook(void *ptr); -// --------------------------- - SANITIZER_INTERFACE_ATTRIBUTE void __msan_dr_is_initialized(); diff --git a/lib/tsan/rtl/tsan_mman.cc b/lib/tsan/rtl/tsan_mman.cc index 8542a8fd0..af11b45e9 100644 --- a/lib/tsan/rtl/tsan_mman.cc +++ b/lib/tsan/rtl/tsan_mman.cc @@ -19,18 +19,11 @@ #include "tsan_flags.h" // May be overriden by front-end. -extern "C" void WEAK __tsan_malloc_hook(void *ptr, uptr size) { - (void)ptr; - (void)size; -} extern "C" void WEAK __sanitizer_malloc_hook(void *ptr, uptr size) { (void)ptr; (void)size; } -extern "C" void WEAK __tsan_free_hook(void *ptr) { - (void)ptr; -} extern "C" void WEAK __sanitizer_free_hook(void *ptr) { (void)ptr; } @@ -147,7 +140,6 @@ void invoke_malloc_hook(void *ptr, uptr size) { ThreadState *thr = cur_thread(); if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors) return; - __tsan_malloc_hook(ptr, size); __sanitizer_malloc_hook(ptr, size); } @@ -155,7 +147,6 @@ void invoke_free_hook(void *ptr) { ThreadState *thr = cur_thread(); if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors) return; - __tsan_free_hook(ptr); __sanitizer_free_hook(ptr); } @@ -188,53 +179,32 @@ uptr __sanitizer_get_current_allocated_bytes() { allocator()->GetStats(stats); return stats[AllocatorStatAllocated]; } -uptr __tsan_get_current_allocated_bytes() { - return __sanitizer_get_current_allocated_bytes(); -} uptr __sanitizer_get_heap_size() { uptr stats[AllocatorStatCount]; allocator()->GetStats(stats); return stats[AllocatorStatMapped]; } -uptr __tsan_get_heap_size() { - return __sanitizer_get_heap_size(); -} uptr __sanitizer_get_free_bytes() { return 1; } -uptr __tsan_get_free_bytes() { - return __sanitizer_get_free_bytes(); -} uptr __sanitizer_get_unmapped_bytes() { return 1; } -uptr __tsan_get_unmapped_bytes() { - return __sanitizer_get_unmapped_bytes(); -} uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; } -uptr __tsan_get_estimated_allocated_size(uptr size) { - return __sanitizer_get_estimated_allocated_size(size); -} int __sanitizer_get_ownership(const void *p) { return allocator()->GetBlockBegin(p) != 0; } -int __tsan_get_ownership(const void *p) { - return __sanitizer_get_ownership(p); -} uptr __sanitizer_get_allocated_size(const void *p) { return user_alloc_usable_size(p); } -uptr __tsan_get_allocated_size(const void *p) { - return __sanitizer_get_allocated_size(p); -} void __tsan_on_thread_idle() { ThreadState *thr = cur_thread(); diff --git a/test/asan/TestCases/Darwin/interface_symbols_darwin.c b/test/asan/TestCases/Darwin/interface_symbols_darwin.c index fb9ede3d8..79e78d681 100644 --- a/test/asan/TestCases/Darwin/interface_symbols_darwin.c +++ b/test/asan/TestCases/Darwin/interface_symbols_darwin.c @@ -11,8 +11,6 @@ // RUN: | grep " T " | sed "s/.* T //" \ // RUN: | grep "__asan_" | sed "s/___asan_/__asan_/" \ // RUN: | sed -E "s/__asan_init_v[0-9]+/__asan_init/" \ -// RUN: | grep -v "__asan_malloc_hook" \ -// RUN: | grep -v "__asan_free_hook" \ // RUN: | grep -v "__asan_default_options" \ // RUN: | grep -v "__asan_on_error" > %t.symbols diff --git a/test/asan/TestCases/Linux/interface_symbols_linux.c b/test/asan/TestCases/Linux/interface_symbols_linux.c index 4ff52d374..a616732ff 100644 --- a/test/asan/TestCases/Linux/interface_symbols_linux.c +++ b/test/asan/TestCases/Linux/interface_symbols_linux.c @@ -4,8 +4,6 @@ // RUN: nm -D %t.exe | grep " T " | sed "s/.* T //" \ // RUN: | grep "__asan_" | sed "s/___asan_/__asan_/" \ // RUN: | sed -E "s/__asan_init_v[0-9]+/__asan_init/" \ -// RUN: | grep -v "__asan_malloc_hook" \ -// RUN: | grep -v "__asan_free_hook" \ // RUN: | grep -v "__asan_default_options" \ // RUN: | grep -v "__asan_stack_" \ // RUN: | grep -v "__asan_on_error" > %t.symbols |