[compiler-rt] r184858 - tsan: add missing __attribute__((visibility("default"))) to interface functions

Dmitry Vyukov dvyukov at google.com
Tue Jun 25 10:09:39 PDT 2013


There are still some moments that are unclear to me:
1. Is INTERCEPTOR_ATTRIBUTE part of public interface of interceptor library?
2. Will it preserve it's meaning over time? It looks like an
implementation detail of interceptor machinery.
3. We do not intercept operator new/delete as interception library
does (i.e. hot patching function prologue). We just define our own
versions. So is it the same?



On Tue, Jun 25, 2013 at 8:55 PM, Sergey Matveev <earthdok at google.com> wrote:
> You also have operators new and delete in this patch.
>
> On Tue, Jun 25, 2013 at 8:40 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
>>
>> __interceptor__setjmp() is not an interceptor, it's an interface function.
>>
>> On Tue, Jun 25, 2013 at 8:25 PM, Sergey Matveev <earthdok at google.com>
>> wrote:
>> > Interface functions that we expose. E.g. __asan_init()
>> >
>> >
>> > On Tue, Jun 25, 2013 at 8:20 PM, Dmitry Vyukov <dvyukov at google.com>
>> > wrote:
>> >>
>> >> What is SANITIZER_INTERFACE_ATTRIBUTE for?
>> >>
>> >> On Tue, Jun 25, 2013 at 7:59 PM, Sergey Matveev <earthdok at google.com>
>> >> wrote:
>> >> > On Linux at least, they expand to the same thing. But I think
>> >> > interface-wise, INTERCEPTOR_ATTRIBUTE is the proper one to use here.
>> >> >
>> >> >
>> >> > On Tue, Jun 25, 2013 at 7:54 PM, Dmitry Vyukov <dvyukov at google.com>
>> >> > wrote:
>> >> >>
>> >> >> I don't know
>> >> >>
>> >> >> On Tue, Jun 25, 2013 at 7:43 PM, Sergey Matveev
>> >> >> <earthdok at google.com>
>> >> >> wrote:
>> >> >> > Shouldn't this be INTERCEPTOR_ATTRIBUTE?
>> >> >> >
>> >> >> >
>> >> >> > On Tue, Jun 25, 2013 at 7:36 PM, Dmitry Vyukov
>> >> >> > <dvyukov at google.com>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Author: dvyukov
>> >> >> >> Date: Tue Jun 25 10:36:25 2013
>> >> >> >> New Revision: 184858
>> >> >> >>
>> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=184858&view=rev
>> >> >> >> Log:
>> >> >> >> tsan: add missing __attribute__((visibility("default"))) to
>> >> >> >> interface
>> >> >> >> functions
>> >> >> >>
>> >> >> >> Modified:
>> >> >> >>     compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>> >> >> >>
>> >> >> >> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>> >> >> >> URL:
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=184858&r1=184857&r2=184858&view=diff
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> ==============================================================================
>> >> >> >> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>> >> >> >> (original)
>> >> >> >> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Tue Jun
>> >> >> >> 25
>> >> >> >> 10:36:25 2013
>> >> >> >> @@ -367,21 +367,29 @@ extern "C" void __tsan_setjmp(uptr sp, u
>> >> >> >>  }
>> >> >> >>
>> >> >> >>  // Not called.  Merely to satisfy TSAN_INTERCEPT().
>> >> >> >> +extern "C" int __interceptor_setjmp(void *env)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  extern "C" int __interceptor_setjmp(void *env) {
>> >> >> >>    CHECK(0);
>> >> >> >>    return 0;
>> >> >> >>  }
>> >> >> >>
>> >> >> >> +extern "C" int __interceptor__setjmp(void *env)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  extern "C" int __interceptor__setjmp(void *env) {
>> >> >> >>    CHECK(0);
>> >> >> >>    return 0;
>> >> >> >>  }
>> >> >> >>
>> >> >> >> +extern "C" int __interceptor_sigsetjmp(void *env)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  extern "C" int __interceptor_sigsetjmp(void *env) {
>> >> >> >>    CHECK(0);
>> >> >> >>    return 0;
>> >> >> >>  }
>> >> >> >>
>> >> >> >> +extern "C" int __interceptor___sigsetjmp(void *env)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  extern "C" int __interceptor___sigsetjmp(void *env) {
>> >> >> >>    CHECK(0);
>> >> >> >>    return 0;
>> >> >> >> @@ -493,15 +501,26 @@ TSAN_INTERCEPTOR(uptr, malloc_usable_siz
>> >> >> >>    invoke_malloc_hook(p, size);  \
>> >> >> >>    return p;
>> >> >> >>
>> >> >> >> +void *operator new(__sanitizer::uptr size)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void *operator new(__sanitizer::uptr size) {
>> >> >> >>    OPERATOR_NEW_BODY(_Znwm);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void *operator new[](__sanitizer::uptr size)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void *operator new[](__sanitizer::uptr size) {
>> >> >> >>    OPERATOR_NEW_BODY(_Znam);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void *operator new(__sanitizer::uptr size, std::nothrow_t
>> >> >> >> const&)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void *operator new(__sanitizer::uptr size, std::nothrow_t
>> >> >> >> const&) {
>> >> >> >>    OPERATOR_NEW_BODY(_ZnwmRKSt9nothrow_t);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void *operator new[](__sanitizer::uptr size, std::nothrow_t
>> >> >> >> const&)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void *operator new[](__sanitizer::uptr size, std::nothrow_t
>> >> >> >> const&)
>> >> >> >> {
>> >> >> >>    OPERATOR_NEW_BODY(_ZnamRKSt9nothrow_t);
>> >> >> >>  }
>> >> >> >> @@ -514,15 +533,26 @@ void *operator new[](__sanitizer::uptr s
>> >> >> >>    SCOPED_INTERCEPTOR_RAW(mangled_name, ptr);  \
>> >> >> >>    user_free(thr, pc, ptr);
>> >> >> >>
>> >> >> >> +void operator delete(void *ptr)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void operator delete(void *ptr) {
>> >> >> >>    OPERATOR_DELETE_BODY(_ZdlPv);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void operator delete[](void *ptr)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void operator delete[](void *ptr) {
>> >> >> >>    OPERATOR_DELETE_BODY(_ZdlPvRKSt9nothrow_t);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void operator delete(void *ptr, std::nothrow_t const&)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void operator delete(void *ptr, std::nothrow_t const&) {
>> >> >> >>    OPERATOR_DELETE_BODY(_ZdaPv);
>> >> >> >>  }
>> >> >> >> +
>> >> >> >> +void operator delete[](void *ptr, std::nothrow_t const&)
>> >> >> >> +    SANITIZER_INTERFACE_ATTRIBUTE;
>> >> >> >>  void operator delete[](void *ptr, std::nothrow_t const&) {
>> >> >> >>    OPERATOR_DELETE_BODY(_ZdaPvRKSt9nothrow_t);
>> >> >> >>  }
>> >> >> >>
>> >> >> >>
>> >> >> >> _______________________________________________
>> >> >> >> llvm-commits mailing list
>> >> >> >> llvm-commits at cs.uiuc.edu
>> >> >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>



More information about the llvm-commits mailing list