<div dir="ltr">Also:<div>* __sanitizer_get_free_bytes() is unimplemented in MSan, TSan where it always returns 1. It's not documented that this function may be unimplemented.</div><div>* __sanitizer_get_allocated_size() has different behavior w.r.t. foreign pointers (ASan dies, MSan and TSan return 0).</div>

<div class="gmail_extra">* generally, the desired behavior of __sanitizer_get_allocated_size() should be documented better. The ASan implementation mentions that "we don't want to expose redzone sizes here" - is that really so? If indeed we want to hide all ASan-specific details, then maybe it should also return 0 for 0-sized mallocs, rather than 1?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">We need tests for this stuff in sanitizer_common...</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 3:41 PM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com" target="_blank">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">cc Dmitry, Evgeniy<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Aug 27, 2014 at 4:28 AM, Alexey Samsonov <<a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a>> wrote:<br>
><br>
> On Tue, Aug 26, 2014 at 7:06 AM, Sergey Matveev <<a href="mailto:earthdok@google.com">earthdok@google.com</a>> wrote:<br>
>><br>
>> 51   /* Number of bytes in unmapped pages, that are released to OS.<br>
>> Currently,<br>
>>  52      always returns 0. */<br>
>>  53   size_t __sanitizer_get_unmapped_bytes();<br>
>><br>
>> actually returns 1 in MSan, TSan<br>
><br>
><br>
> This is somewhat stupid. Dmitry, Evgeniy - do you remember the reason behind<br>
> this, or we should better fix it in TSan/MSan?<br>
><br>
>><br>
>><br>
>><br>
>> On Wed, Aug 13, 2014 at 12:28 AM, Alexey Samsonov <<a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Author: samsonov<br>
>>> Date: Tue Aug 12 15:28:20 2014<br>
>>> New Revision: 215469<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=215469&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=215469&view=rev</a><br>
>>> Log:<br>
>>> [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan<br>
>>> in favor of<br>
>>> a unified interface in <sanitizer/allocator_interface.h>.<br>
>>><br>
>>> Modified:<br>
>>>     compiler-rt/trunk/include/sanitizer/asan_interface.h<br>
>>>     compiler-rt/trunk/include/sanitizer/msan_interface.h<br>
>>>     compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
>>>     compiler-rt/trunk/lib/asan/asan_interface_internal.h<br>
>>>     compiler-rt/trunk/lib/asan/asan_internal.h<br>
>>>     compiler-rt/trunk/lib/asan/asan_rtl.cc<br>
>>>     compiler-rt/trunk/lib/asan/asan_stats.cc<br>
>>>     compiler-rt/trunk/lib/msan/msan.h<br>
>>>     compiler-rt/trunk/lib/msan/msan_allocator.cc<br>
>>>     compiler-rt/trunk/lib/msan/msan_interface_internal.h<br>
>>>     compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc<br>
>>><br>
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c<br>
>>>     compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
>>><br>
>>> Modified: compiler-rt/trunk/include/sanitizer/asan_interface.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/asan_interface.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/asan_interface.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/include/sanitizer/asan_interface.h (original)<br>
>>> +++ compiler-rt/trunk/include/sanitizer/asan_interface.h Tue Aug 12<br>
>>> 15:28:20 2014<br>
>>> @@ -99,46 +99,6 @@ extern "C" {<br>
>>>    // the program crashes before ASan report is printed.<br>
>>>    void __asan_on_error();<br>
>>><br>
>>> -  // Returns the estimated number of bytes that will be reserved by<br>
>>> allocator<br>
>>> -  // for request of "size" bytes. If ASan allocator can't allocate that<br>
>>> much<br>
>>> -  // memory, returns the maximal possible allocation size, otherwise<br>
>>> returns<br>
>>> -  // "size".<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead.<br>
>>> */<br>
>>> -  size_t __asan_get_estimated_allocated_size(size_t size);<br>
>>> -<br>
>>> -  // Returns 1 if p was returned by the ASan allocator and is not yet<br>
>>> freed.<br>
>>> -  // Otherwise returns 0.<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_ownership instead. */<br>
>>> -  int __asan_get_ownership(const void *p);<br>
>>> -<br>
>>> -  // Returns the number of bytes reserved for the pointer p.<br>
>>> -  // Requires (get_ownership(p) == true) or (p == 0).<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */<br>
>>> -  size_t __asan_get_allocated_size(const void *p);<br>
>>> -<br>
>>> -  // Number of bytes, allocated and not yet freed by the application.<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */<br>
>>> -  size_t __asan_get_current_allocated_bytes();<br>
>>> -<br>
>>> -  // Number of bytes, mmaped by asan allocator to fulfill allocation<br>
>>> requests.<br>
>>> -  // Generally, for request of X bytes, allocator can reserve and add to<br>
>>> free<br>
>>> -  // lists a large number of chunks of size X to use them for future<br>
>>> requests.<br>
>>> -  // All these chunks count toward the heap size. Currently, allocator<br>
>>> never<br>
>>> -  // releases memory to OS (instead, it just puts freed chunks to free<br>
>>> lists).<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_heap_size instead. */<br>
>>> -  size_t __asan_get_heap_size();<br>
>>> -<br>
>>> -  // Number of bytes, mmaped by asan allocator, which can be used to<br>
>>> fulfill<br>
>>> -  // allocation requests. When a user program frees memory chunk, it can<br>
>>> first<br>
>>> -  // fall into quarantine and will count toward __asan_get_free_bytes()<br>
>>> later.<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */<br>
>>> -  size_t __asan_get_free_bytes();<br>
>>> -<br>
>>> -  // Number of bytes in unmapped pages, that are released to OS.<br>
>>> Currently,<br>
>>> -  // always returns 0.<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */<br>
>>> -  size_t __asan_get_unmapped_bytes();<br>
>>> -<br>
>>>    // Prints accumulated stats to stderr. Used for debugging.<br>
>>>    void __asan_print_accumulated_stats();<br>
>>><br>
>>> @@ -146,15 +106,6 @@ extern "C" {<br>
>>>    // a string containing ASan runtime options. See asan_flags.h for<br>
>>> details.<br>
>>>    const char* __asan_default_options();<br>
>>><br>
>>> -  // Malloc hooks that may be optionally provided by user.<br>
>>> -  // __asan_malloc_hook(ptr, size) is called immediately after<br>
>>> -  //   allocation of "size" bytes, which returned "ptr".<br>
>>> -  // __asan_free_hook(ptr) is called immediately before<br>
>>> -  //   deallocation of "ptr".<br>
>>> -  /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook<br>
>>> instead. */<br>
>>> -  void __asan_malloc_hook(void *ptr, size_t size);<br>
>>> -  void __asan_free_hook(void *ptr);<br>
>>> -<br>
>>>    // The following 2 functions facilitate garbage collection in presence<br>
>>> of<br>
>>>    // asan's fake stack.<br>
>>><br>
>>><br>
>>> Modified: compiler-rt/trunk/include/sanitizer/msan_interface.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/msan_interface.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/msan_interface.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/include/sanitizer/msan_interface.h (original)<br>
>>> +++ compiler-rt/trunk/include/sanitizer/msan_interface.h Tue Aug 12<br>
>>> 15:28:20 2014<br>
>>> @@ -93,60 +93,6 @@ extern "C" {<br>
>>>       Passing 0 will unset the callback. */<br>
>>>    void __msan_set_death_callback(void (*callback)(void));<br>
>>><br>
>>> -  /***********************************/<br>
>>> -  /* Allocator statistics interface. */<br>
>>> -<br>
>>> -  /* Returns the estimated number of bytes that will be reserved by<br>
>>> allocator<br>
>>> -     for request of "size" bytes. If Msan allocator can't allocate that<br>
>>> much<br>
>>> -     memory, returns the maximal possible allocation size, otherwise<br>
>>> returns<br>
>>> -     "size". */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead.<br>
>>> */<br>
>>> -  size_t __msan_get_estimated_allocated_size(size_t size);<br>
>>> -<br>
>>> -  /* Returns true if p was returned by the Msan allocator and<br>
>>> -     is not yet freed. */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_ownership instead. */<br>
>>> -  int __msan_get_ownership(const volatile void *p);<br>
>>> -<br>
>>> -  /* Returns the number of bytes reserved for the pointer p.<br>
>>> -     Requires (get_ownership(p) == true) or (p == 0). */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */<br>
>>> -  size_t __msan_get_allocated_size(const volatile void *p);<br>
>>> -<br>
>>> -  /* Number of bytes, allocated and not yet freed by the application. */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */<br>
>>> -  size_t __msan_get_current_allocated_bytes();<br>
>>> -<br>
>>> -  /* Number of bytes, mmaped by msan allocator to fulfill allocation<br>
>>> requests.<br>
>>> -     Generally, for request of X bytes, allocator can reserve and add to<br>
>>> free<br>
>>> -     lists a large number of chunks of size X to use them for future<br>
>>> requests.<br>
>>> -     All these chunks count toward the heap size. Currently, allocator<br>
>>> never<br>
>>> -     releases memory to OS (instead, it just puts freed chunks to free<br>
>>> -     lists). */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_heap_size instead. */<br>
>>> -  size_t __msan_get_heap_size();<br>
>>> -<br>
>>> -  /* Number of bytes, mmaped by msan allocator, which can be used to<br>
>>> fulfill<br>
>>> -     allocation requests. When a user program frees memory chunk, it can<br>
>>> first<br>
>>> -     fall into quarantine and will count toward __msan_get_free_bytes()<br>
>>> -     later. */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */<br>
>>> -  size_t __msan_get_free_bytes();<br>
>>> -<br>
>>> -  /* Number of bytes in unmapped pages, that are released to OS.<br>
>>> Currently,<br>
>>> -     always returns 0. */<br>
>>> -  /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */<br>
>>> -  size_t __msan_get_unmapped_bytes();<br>
>>> -<br>
>>> -  /* Malloc hooks that may be optionally provided by user.<br>
>>> -     __msan_malloc_hook(ptr, size) is called immediately after<br>
>>> -       allocation of "size" bytes, which returned "ptr".<br>
>>> -     __msan_free_hook(ptr) is called immediately before<br>
>>> -       deallocation of "ptr". */<br>
>>> -  /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook<br>
>>> instead. */<br>
>>> -  void __msan_malloc_hook(const volatile void *ptr, size_t size);<br>
>>> -  void __msan_free_hook(const volatile void *ptr);<br>
>>> -<br>
>>>  #ifdef __cplusplus<br>
>>>  }  // extern "C"<br>
>>>  #endif<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Tue Aug 12 15:28:20<br>
>>> 2014<br>
>>> @@ -757,17 +757,11 @@ using namespace __asan;  // NOLINT<br>
>>>  uptr __sanitizer_get_estimated_allocated_size(uptr size) {<br>
>>>    return size;<br>
>>>  }<br>
>>> -uptr __asan_get_estimated_allocated_size(uptr size) {<br>
>>> -  return __sanitizer_get_estimated_allocated_size(size);<br>
>>> -}<br>
>>><br>
>>>  int __sanitizer_get_ownership(const void *p) {<br>
>>>    uptr ptr = reinterpret_cast<uptr>(p);<br>
>>>    return (AllocationSize(ptr) > 0);<br>
>>>  }<br>
>>> -int __asan_get_ownership(const void *p) {<br>
>>> -  return __sanitizer_get_ownership(p);<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_allocated_size(const void *p) {<br>
>>>    if (p == 0) return 0;<br>
>>> @@ -780,23 +774,11 @@ uptr __sanitizer_get_allocated_size(cons<br>
>>>    }<br>
>>>    return allocated_size;<br>
>>>  }<br>
>>> -uptr __asan_get_allocated_size(const void *p) {<br>
>>> -  return __sanitizer_get_allocated_size(p);<br>
>>> -}<br>
>>><br>
>>>  #if !SANITIZER_SUPPORTS_WEAK_HOOKS<br>
>>>  // Provide default (no-op) implementation of malloc hooks.<br>
>>>  extern "C" {<br>
>>>  SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -void __asan_malloc_hook(void *ptr, uptr size) {<br>
>>> -  (void)ptr;<br>
>>> -  (void)size;<br>
>>> -}<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -void __asan_free_hook(void *ptr) {<br>
>>> -  (void)ptr;<br>
>>> -}<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>>  void __sanitizer_malloc_hook(void *ptr, uptr size) {<br>
>>>    (void)ptr;<br>
>>>    (void)size;<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/asan/asan_interface_internal.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/asan/asan_interface_internal.h (original)<br>
>>> +++ compiler-rt/trunk/lib/asan/asan_interface_internal.h Tue Aug 12<br>
>>> 15:28:20 2014<br>
>>> @@ -115,22 +115,6 @@ extern "C" {<br>
>>>    SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>>    /* OPTIONAL */ void __asan_on_error();<br>
>>><br>
>>> -  // ---------------------------<br>
>>> -  // FIXME: Replace these functions with __sanitizer equivalent.<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -  uptr __asan_get_estimated_allocated_size(uptr size);<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE int __asan_get_ownership(const void *p);<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_allocated_size(const<br>
>>> void *p);<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE uptr<br>
>>> __asan_get_current_allocated_bytes();<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_heap_size();<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_free_bytes();<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE uptr __asan_get_unmapped_bytes();<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -  /* OPTIONAL */ void __asan_malloc_hook(void *ptr, uptr size);<br>
>>> -  SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -  /* OPTIONAL */ void __asan_free_hook(void *ptr);<br>
>>> -  // ---------------------------<br>
>>> -<br>
>>>    SANITIZER_INTERFACE_ATTRIBUTE void __asan_print_accumulated_stats();<br>
>>><br>
>>>    SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/asan/asan_internal.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/asan/asan_internal.h (original)<br>
>>> +++ compiler-rt/trunk/lib/asan/asan_internal.h Tue Aug 12 15:28:20 2014<br>
>>> @@ -108,10 +108,8 @@ bool PlatformHasDifferentMemcpyAndMemmov<br>
>>>  // Add convenient macro for interface functions that may be represented<br>
>>> as<br>
>>>  // weak hooks.<br>
>>>  #define ASAN_MALLOC_HOOK(ptr, size) \<br>
>>> -  if (&__asan_malloc_hook) __asan_malloc_hook(ptr, size); \<br>
>>>    if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size)<br>
>>>  #define ASAN_FREE_HOOK(ptr) \<br>
>>> -  if (&__asan_free_hook) __asan_free_hook(ptr); \<br>
>>>    if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr)<br>
>>>  #define ASAN_ON_ERROR() \<br>
>>>    if (&__asan_on_error) __asan_on_error()<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Aug 12 15:28:20 2014<br>
>>> @@ -468,13 +468,6 @@ static NOINLINE void force_interface_sym<br>
>>>      case 15: __asan_set_error_report_callback(0); break;<br>
>>>      case 16: __asan_handle_no_return(); break;<br>
>>>      case 17: __asan_address_is_poisoned(0); break;<br>
>>> -    case 18: __asan_get_allocated_size(0); break;<br>
>>> -    case 19: __asan_get_current_allocated_bytes(); break;<br>
>>> -    case 20: __asan_get_estimated_allocated_size(0); break;<br>
>>> -    case 21: __asan_get_free_bytes(); break;<br>
>>> -    case 22: __asan_get_heap_size(); break;<br>
>>> -    case 23: __asan_get_ownership(0); break;<br>
>>> -    case 24: __asan_get_unmapped_bytes(); break;<br>
>>>      case 25: __asan_poison_memory_region(0, 0); break;<br>
>>>      case 26: __asan_unpoison_memory_region(0, 0); break;<br>
>>>      case 27: __asan_set_error_exit_code(0); break;<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/asan/asan_stats.cc<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stats.cc?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stats.cc?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/asan/asan_stats.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/asan/asan_stats.cc Tue Aug 12 15:28:20 2014<br>
>>> @@ -149,18 +149,12 @@ uptr __sanitizer_get_current_allocated_b<br>
>>>    // way we update accumulated stats.<br>
>>>    return (malloced > freed) ? malloced - freed : 1;<br>
>>>  }<br>
>>> -uptr __asan_get_current_allocated_bytes() {<br>
>>> -  return __sanitizer_get_current_allocated_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_heap_size() {<br>
>>>    AsanStats stats;<br>
>>>    GetAccumulatedStats(&stats);<br>
>>>    return stats.mmaped - stats.munmaped;<br>
>>>  }<br>
>>> -uptr __asan_get_heap_size() {<br>
>>> -  return __sanitizer_get_heap_size();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_free_bytes() {<br>
>>>    AsanStats stats;<br>
>>> @@ -175,16 +169,10 @@ uptr __sanitizer_get_free_bytes() {<br>
>>>    // way we update accumulated stats.<br>
>>>    return (total_free > total_used) ? total_free - total_used : 1;<br>
>>>  }<br>
>>> -uptr __asan_get_free_bytes() {<br>
>>> -  return __sanitizer_get_free_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_unmapped_bytes() {<br>
>>>    return 0;<br>
>>>  }<br>
>>> -uptr __asan_get_unmapped_bytes() {<br>
>>> -  return __sanitizer_get_unmapped_bytes();<br>
>>> -}<br>
>>><br>
>>>  void __asan_print_accumulated_stats() {<br>
>>>    PrintAccumulatedStats();<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/msan/msan.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/msan/msan.h (original)<br>
>>> +++ compiler-rt/trunk/lib/msan/msan.h Tue Aug 12 15:28:20 2014<br>
>>> @@ -141,10 +141,8 @@ void MsanTSDDtor(void *tsd);<br>
>>>  }  // namespace __msan<br>
>>><br>
>>>  #define MSAN_MALLOC_HOOK(ptr, size) \<br>
>>> -  if (&__msan_malloc_hook) __msan_malloc_hook(ptr, size); \<br>
>>>    if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size)<br>
>>>  #define MSAN_FREE_HOOK(ptr) \<br>
>>> -  if (&__msan_free_hook) __msan_free_hook(ptr); \<br>
>>>    if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr)<br>
>>><br>
>>>  #endif  // MSAN_H<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/msan/msan_allocator.cc<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_allocator.cc?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_allocator.cc?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/msan/msan_allocator.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/msan/msan_allocator.cc Tue Aug 12 15:28:20 2014<br>
>>> @@ -188,40 +188,19 @@ uptr __sanitizer_get_current_allocated_b<br>
>>>    allocator.GetStats(stats);<br>
>>>    return stats[AllocatorStatAllocated];<br>
>>>  }<br>
>>> -uptr __msan_get_current_allocated_bytes() {<br>
>>> -  return __sanitizer_get_current_allocated_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_heap_size() {<br>
>>>    uptr stats[AllocatorStatCount];<br>
>>>    allocator.GetStats(stats);<br>
>>>    return stats[AllocatorStatMapped];<br>
>>>  }<br>
>>> -uptr __msan_get_heap_size() {<br>
>>> -  return __sanitizer_get_heap_size();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_free_bytes() { return 1; }<br>
>>> -uptr __msan_get_free_bytes() {<br>
>>> -  return __sanitizer_get_free_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_unmapped_bytes() { return 1; }<br>
>>> -uptr __msan_get_unmapped_bytes() {<br>
>>> -  return __sanitizer_get_unmapped_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size;<br>
>>> }<br>
>>> -uptr __msan_get_estimated_allocated_size(uptr size) {<br>
>>> -  return __sanitizer_get_estimated_allocated_size(size);<br>
>>> -}<br>
>>><br>
>>>  int __sanitizer_get_ownership(const void *p) { return AllocationSize(p)<br>
>>> != 0; }<br>
>>> -int __msan_get_ownership(const void *p) {<br>
>>> -  return __sanitizer_get_ownership(p);<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_allocated_size(const void *p) { return<br>
>>> AllocationSize(p); }<br>
>>> -uptr __msan_get_allocated_size(const void *p) {<br>
>>> -  return __sanitizer_get_allocated_size(p);<br>
>>> -}<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/msan/msan_interface_internal.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interface_internal.h?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/msan/msan_interface_internal.h (original)<br>
>>> +++ compiler-rt/trunk/lib/msan/msan_interface_internal.h Tue Aug 12<br>
>>> 15:28:20 2014<br>
>>> @@ -161,28 +161,6 @@ void __sanitizer_unaligned_store32(uu32<br>
>>>  SANITIZER_INTERFACE_ATTRIBUTE<br>
>>>  void __sanitizer_unaligned_store64(uu64 *p, u64 x);<br>
>>><br>
>>> -// ---------------------------<br>
>>> -// FIXME: Replace these functions with __sanitizer equivalent.<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_estimated_allocated_size(uptr size);<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -int __msan_get_ownership(const void *p);<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_allocated_size(const void *p);<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_current_allocated_bytes();<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_heap_size();<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_free_bytes();<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE<br>
>>> -uptr __msan_get_unmapped_bytes();<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -/* OPTIONAL */ void __msan_malloc_hook(void *ptr, uptr size);<br>
>>> -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE<br>
>>> -/* OPTIONAL */ void __msan_free_hook(void *ptr);<br>
>>> -// ---------------------------<br>
>>> -<br>
>>>  SANITIZER_INTERFACE_ATTRIBUTE<br>
>>>  void __msan_dr_is_initialized();<br>
>>><br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc?rev=215469&r1=215468&r2=215469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc?rev=215469&r1=215468&r2=215469&view=diff</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc Tue Aug 12 15:28:20 2014<br>
>>> @@ -19,18 +19,11 @@<br>
>>>  #include "tsan_flags.h"<br>
>>><br>
>>>  // May be overriden by front-end.<br>
>>> -extern "C" void WEAK __tsan_malloc_hook(void *ptr, uptr size) {<br>
>>> -  (void)ptr;<br>
>>> -  (void)size;<br>
>>> -}<br>
>>>  extern "C" void WEAK __sanitizer_malloc_hook(void *ptr, uptr size) {<br>
>>>    (void)ptr;<br>
>>>    (void)size;<br>
>>>  }<br>
>>><br>
>>> -extern "C" void WEAK __tsan_free_hook(void *ptr) {<br>
>>> -  (void)ptr;<br>
>>> -}<br>
>>>  extern "C" void WEAK __sanitizer_free_hook(void *ptr) {<br>
>>>    (void)ptr;<br>
>>>  }<br>
>>> @@ -147,7 +140,6 @@ void invoke_malloc_hook(void *ptr, uptr<br>
>>>    ThreadState *thr = cur_thread();<br>
>>>    if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)<br>
>>>      return;<br>
>>> -  __tsan_malloc_hook(ptr, size);<br>
>>>    __sanitizer_malloc_hook(ptr, size);<br>
>>>  }<br>
>>><br>
>>> @@ -155,7 +147,6 @@ void invoke_free_hook(void *ptr) {<br>
>>>    ThreadState *thr = cur_thread();<br>
>>>    if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)<br>
>>>      return;<br>
>>> -  __tsan_free_hook(ptr);<br>
>>>    __sanitizer_free_hook(ptr);<br>
>>>  }<br>
>>><br>
>>> @@ -188,53 +179,32 @@ uptr __sanitizer_get_current_allocated_b<br>
>>>    allocator()->GetStats(stats);<br>
>>>    return stats[AllocatorStatAllocated];<br>
>>>  }<br>
>>> -uptr __tsan_get_current_allocated_bytes() {<br>
>>> -  return __sanitizer_get_current_allocated_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_heap_size() {<br>
>>>    uptr stats[AllocatorStatCount];<br>
>>>    allocator()->GetStats(stats);<br>
>>>    return stats[AllocatorStatMapped];<br>
>>>  }<br>
>>> -uptr __tsan_get_heap_size() {<br>
>>> -  return __sanitizer_get_heap_size();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_free_bytes() {<br>
>>>    return 1;<br>
>>>  }<br>
>>> -uptr __tsan_get_free_bytes() {<br>
>>> -  return __sanitizer_get_free_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_unmapped_bytes() {<br>
>>>    return 1;<br>
>>>  }<br>
>>> -uptr __tsan_get_unmapped_bytes() {<br>
>>> -  return __sanitizer_get_unmapped_bytes();<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_estimated_allocated_size(uptr size) {<br>
>>>    return size;<br>
>>>  }<br>
>>> -uptr __tsan_get_estimated_allocated_size(uptr size) {<br>
>>> -  return __sanitizer_get_estimated_allocated_size(size);<br>
>>> -}<br>
>>><br>
>>>  int __sanitizer_get_ownership(const void *p) {<br>
>>>    return allocator()->GetBlockBegin(p) != 0;<br>
>>>  }<br>
>>> -int __tsan_get_ownership(const void *p) {<br>
>>> -  return __sanitizer_get_ownership(p);<br>
>>> -}<br>
>>><br>
>>>  uptr __sanitizer_get_allocated_size(const void *p) {<br>
>>>    return user_alloc_usable_size(p);<br>
>>>  }<br>
>>> -uptr __tsan_get_allocated_size(const void *p) {<br>
>>> -  return __sanitizer_get_allocated_size(p);<br>
>>> -}<br>
>>><br>
>>>  void __tsan_on_thread_idle() {<br>
>>>    ThreadState *thr = cur_thread();<br>
>>><br>
>>> Modified:<br>
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c<br>
>>> URL:<br>
>>> <a href="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" target="_blank">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</a><br>

>>><br>
>>> ==============================================================================<br>
>>> ---<br>
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c<br>
>>> (original)<br>
>>> +++<br>
>>> compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c Tue<br>
>>> Aug 12 15:28:20 2014<br>
>>> @@ -11,8 +11,6 @@<br>
>>>  // RUN:   | grep " T " | sed "s/.* T //" \<br>
>>>  // RUN:   | grep "__asan_" | sed "s/___asan_/__asan_/" \<br>
>>>  // RUN:   | sed -E "s/__asan_init_v[0-9]+/__asan_init/" \<br>
>>> -// RUN:   | grep -v "__asan_malloc_hook" \<br>
>>> -// RUN:   | grep -v "__asan_free_hook" \<br>
>>>  // RUN:   | grep -v "__asan_default_options" \<br>
>>>  // RUN:   | grep -v "__asan_on_error" > %t.symbols<br>
>>><br>
>>><br>
>>> Modified:<br>
>>> compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
>>> URL:<br>
>>> <a href="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" target="_blank">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</a><br>

>>><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
>>> (original)<br>
>>> +++ compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
>>> Tue Aug 12 15:28:20 2014<br>
>>> @@ -4,8 +4,6 @@<br>
>>>  // RUN: nm -D %t.exe | grep " T " | sed "s/.* T //" \<br>
>>>  // RUN:    | grep "__asan_" | sed "s/___asan_/__asan_/" \<br>
>>>  // RUN:    | sed -E "s/__asan_init_v[0-9]+/__asan_init/" \<br>
>>> -// RUN:    | grep -v "__asan_malloc_hook" \<br>
>>> -// RUN:    | grep -v "__asan_free_hook" \<br>
>>>  // RUN:    | grep -v "__asan_default_options" \<br>
>>>  // RUN:    | grep -v "__asan_stack_" \<br>
>>>  // RUN:    | grep -v "__asan_on_error" > %t.symbols<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> Alexey Samsonov<br>
> <a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
<br>
<br>
<br>
--<br>
</div></div><span class="HOEnZb"><font color="#888888">Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div></div>