[compiler-rt] r215469 - [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in favor of

Alexander Potapenko glider at google.com
Wed Aug 27 04:41:42 PDT 2014


cc Dmitry, Evgeniy

On Wed, Aug 27, 2014 at 4:28 AM, Alexey Samsonov <vonosmas at gmail.com> wrote:
>
> On Tue, Aug 26, 2014 at 7:06 AM, Sergey Matveev <earthdok at google.com> wrote:
>>
>> 51   /* Number of bytes in unmapped pages, that are released to OS.
>> Currently,
>>  52      always returns 0. */
>>  53   size_t __sanitizer_get_unmapped_bytes();
>>
>> actually returns 1 in MSan, TSan
>
>
> This is somewhat stupid. Dmitry, Evgeniy - do you remember the reason behind
> this, or we should better fix it in TSan/MSan?
>
>>
>>
>>
>> On Wed, Aug 13, 2014 at 12:28 AM, Alexey Samsonov <vonosmas at gmail.com>
>> wrote:
>>>
>>> Author: samsonov
>>> Date: Tue Aug 12 15:28:20 2014
>>> New Revision: 215469
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=215469&view=rev
>>> Log:
>>> [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan
>>> in favor of
>>> a unified interface in <sanitizer/allocator_interface.h>.
>>>
>>> Modified:
>>>     compiler-rt/trunk/include/sanitizer/asan_interface.h
>>>     compiler-rt/trunk/include/sanitizer/msan_interface.h
>>>     compiler-rt/trunk/lib/asan/asan_allocator2.cc
>>>     compiler-rt/trunk/lib/asan/asan_interface_internal.h
>>>     compiler-rt/trunk/lib/asan/asan_internal.h
>>>     compiler-rt/trunk/lib/asan/asan_rtl.cc
>>>     compiler-rt/trunk/lib/asan/asan_stats.cc
>>>     compiler-rt/trunk/lib/msan/msan.h
>>>     compiler-rt/trunk/lib/msan/msan_allocator.cc
>>>     compiler-rt/trunk/lib/msan/msan_interface_internal.h
>>>     compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc
>>>
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c
>>>     compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
>>>
>>> Modified: compiler-rt/trunk/include/sanitizer/asan_interface.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/asan_interface.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/include/sanitizer/asan_interface.h (original)
>>> +++ compiler-rt/trunk/include/sanitizer/asan_interface.h Tue Aug 12
>>> 15:28:20 2014
>>> @@ -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.
>>>
>>>
>>> Modified: compiler-rt/trunk/include/sanitizer/msan_interface.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/msan_interface.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/include/sanitizer/msan_interface.h (original)
>>> +++ compiler-rt/trunk/include/sanitizer/msan_interface.h Tue Aug 12
>>> 15:28:20 2014
>>> @@ -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
>>>
>>> Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
>>> +++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Tue Aug 12 15:28:20
>>> 2014
>>> @@ -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(cons
>>>    }
>>>    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;
>>>
>>> Modified: compiler-rt/trunk/lib/asan/asan_interface_internal.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/asan/asan_interface_internal.h (original)
>>> +++ compiler-rt/trunk/lib/asan/asan_interface_internal.h Tue Aug 12
>>> 15:28:20 2014
>>> @@ -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
>>>
>>> Modified: compiler-rt/trunk/lib/asan/asan_internal.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/asan/asan_internal.h (original)
>>> +++ compiler-rt/trunk/lib/asan/asan_internal.h Tue Aug 12 15:28:20 2014
>>> @@ -108,10 +108,8 @@ bool PlatformHasDifferentMemcpyAndMemmov
>>>  // 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()
>>>
>>> Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
>>> +++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Aug 12 15:28:20 2014
>>> @@ -468,13 +468,6 @@ static NOINLINE void force_interface_sym
>>>      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;
>>>
>>> Modified: compiler-rt/trunk/lib/asan/asan_stats.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stats.cc?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/asan/asan_stats.cc (original)
>>> +++ compiler-rt/trunk/lib/asan/asan_stats.cc Tue Aug 12 15:28:20 2014
>>> @@ -149,18 +149,12 @@ uptr __sanitizer_get_current_allocated_b
>>>    // 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();
>>>
>>> Modified: compiler-rt/trunk/lib/msan/msan.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/msan/msan.h (original)
>>> +++ compiler-rt/trunk/lib/msan/msan.h Tue Aug 12 15:28:20 2014
>>> @@ -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
>>>
>>> Modified: compiler-rt/trunk/lib/msan/msan_allocator.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_allocator.cc?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/msan/msan_allocator.cc (original)
>>> +++ compiler-rt/trunk/lib/msan/msan_allocator.cc Tue Aug 12 15:28:20 2014
>>> @@ -188,40 +188,19 @@ uptr __sanitizer_get_current_allocated_b
>>>    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);
>>> -}
>>>
>>> Modified: compiler-rt/trunk/lib/msan/msan_interface_internal.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/msan/msan_interface_internal.h (original)
>>> +++ compiler-rt/trunk/lib/msan/msan_interface_internal.h Tue Aug 12
>>> 15:28:20 2014
>>> @@ -161,28 +161,6 @@ void __sanitizer_unaligned_store32(uu32
>>>  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();
>>>
>>>
>>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc (original)
>>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc Tue Aug 12 15:28:20 2014
>>> @@ -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
>>>    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_b
>>>    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();
>>>
>>> Modified:
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c
>>> (original)
>>> +++
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c Tue
>>> Aug 12 15:28:20 2014
>>> @@ -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
>>>
>>>
>>> Modified:
>>> compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c?rev=215469&r1=215468&r2=215469&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
>>> (original)
>>> +++ compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
>>> Tue Aug 12 15:28:20 2014
>>> @@ -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
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list