[Bug sanitizer/68824] [6 Regression] libtsan is missing the __interceptor___tls_get_addr symbol without bumping the soname

dvyukov at google dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 10 11:25:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68824

Dmitry Vyukov <dvyukov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dvyukov at google dot com

--- Comment #2 from Dmitry Vyukov <dvyukov at google dot com> ---
__interceptor_* are meant to be called by user when it tries to do the same as
asan/tsan --  intercept some system library functions. We've hit this at least
three times: interception of pthread synchronization functions to add some
weird functionality, interception of mmap/munmap for accounting, interception
of most of glibc functions to implicitly extend functionality.
The pattern looks as following in such case:

void *find_original_function(string name) {
#ifdef ASAN|TSAN
  if (f = dlsym(RTLD_DEFAULT, "__interceptor_" + name)
    return f;
#endif
  return dlsym(RTLD_NEXT, name);
}

Asan/tsan interceptors are especially made weak for this purpose. If user
defines the same functions, interceptors silently vanish. But the
__interceptor_* things stay and can be called by user.

I don't fully understand what happens here, but "Or perhaps it should just be
versioned using an anonymous version script, to only control what symbols are
exported and what symbols are not" sounds good to me.


More information about the Gcc-bugs mailing list