[compiler-rt] r293741 - [sanitizer] Support SANITIZER_INTERCEPTOR_HOOKS on Darwin

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 15:45:00 PST 2017


Justin, Marcos,

Because of the recent changes ToT clang has stopped building fuzzers in the
chrome (see below).

This change:

https://github.com/llvm-mirror/compiler-rt/commit/55845b4a38ec980454781b2b37fcf4a92ebe48ce

is an obvious suspect, but I feel there might be an error in weak-related
recent changes elsewhere.

Do you think this is related?

FAILED: ../../../../../out/llvm/bootstrap/bin/clang++
-Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro
-fuse-ld=gold -B../../third_party/binutils/Linux_x64/Release/bin
-Wl,--threads -Wl,--thread-count=4 -m64 -pthread -Werror -Wl,-O1
-Wl,--gc-sections
--sysroot=../../build/linux/debian_wheezy_amd64-sysroot
-L/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/lib/x86_64-linux-gnu
-Wl,-rpath-link=/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/lib/x86_64-linux-gnu
-L/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu
-Wl,-rpath-link=/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu
-L/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6
-Wl,-rpath-link=/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6
-L/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib
-Wl,-rpath-link=/usr/local/google/home/aizatsky/src/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib
-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak
-fsanitize-coverage=trace-pc-guard -Wl,-rpath-link=.
-Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=.
-Wl,--export-dynamic -Wl,-u_sanitizer_options_link_helper
-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak
-fsanitize-coverage=trace-pc-guard -stdlib=libc++ -Wl,-rpath,\$ORIGIN/
-L. -o "./webcrypto_ec_import_key_spki_fuzzer" -Wl,--start-group
@"./webcrypto_ec_import_key_spki_fuzzer.rsp" ./libc++.so
-Wl,--end-group  -ldl -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0
-lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4
-lpangocairo-1.0 -lpango-1.0 -lcairo -lfontconfig -lfreetype -lgio-2.0
-lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes
-lXi -lXrender -lXtst -lXrandr -lXss -lgconf-2 -lresolv -lasound -lm
-lz -ldbus-1
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strcmp'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strncmp'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strcasecmp'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strncasecmp'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strstr'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_strcasestr'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_memmem'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: warning:
Cannot export local symbol '__sanitizer_weak_hook_memcmp'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: error:
treating warnings as errors


On Tue, Jan 31, 2017 at 7:42 PM Justin Bogner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: bogner
> Date: Tue Jan 31 21:31:09 2017
> New Revision: 293741
>
> URL: http://llvm.org/viewvc/llvm-project?rev=293741&view=rev
> Log:
> [sanitizer] Support SANITIZER_INTERCEPTOR_HOOKS on Darwin
>
> This basically already worked other than weak symbols needing
> definitions on darwin.
>
> Added:
>
> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc
>       - copied, changed from r293734,
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc
> Removed:
>
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc
> Modified:
>
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=293741&r1=293740&r2=293741&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> (original)
> +++
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> Tue Jan 31 21:31:09 2017
> @@ -44,15 +44,9 @@
>  #include <stdarg.h>
>
>  #if SANITIZER_INTERCEPTOR_HOOKS
> -#define CALL_WEAK_INTERCEPTOR_HOOK(f, ...)
>      \
> -  do {
>      \
> -    if (f)
>      \
> -      f(__VA_ARGS__);
>       \
> -  } while (false);
> -#define DECLARE_WEAK_INTERCEPTOR_HOOK(f, ...)
>       \
> -  extern "C" {
>      \
> -  SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
> f(__VA_ARGS__);  \
> -  } // extern "C"
> +#define CALL_WEAK_INTERCEPTOR_HOOK(f, ...) f(__VA_ARGS__);
> +#define DECLARE_WEAK_INTERCEPTOR_HOOK(f, ...) \
> +  SANITIZER_INTERFACE_WEAK_DEF(void, f, __VA_ARGS__) {}
>  #else
>  #define DECLARE_WEAK_INTERCEPTOR_HOOK(f, ...)
>  #define CALL_WEAK_INTERCEPTOR_HOOK(f, ...)
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=293741&r1=293740&r2=293741&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> (original)
> +++
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> Tue Jan 31 21:31:09 2017
> @@ -302,7 +302,7 @@
>  #define SANITIZER_INTERCEPT_CTERMID SI_LINUX || SI_MAC || SI_FREEBSD
>  #define SANITIZER_INTERCEPT_CTERMID_R SI_MAC || SI_FREEBSD
>
> -#define SANITIZER_INTERCEPTOR_HOOKS SI_LINUX
> +#define SANITIZER_INTERCEPTOR_HOOKS SI_LINUX || SI_MAC
>  #define SANITIZER_INTERCEPT_RECV_RECVFROM SI_NOT_WINDOWS
>  #define SANITIZER_INTERCEPT_SEND_SENDTO SI_NOT_WINDOWS
>  #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX
>
> Removed:
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc?rev=293740&view=auto
>
> ==============================================================================
> ---
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc
> (original)
> +++
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc
> (removed)
> @@ -1,82 +0,0 @@
> -// Test the weak hooks.
> -// RUN: %clangxx %s -o %t
> -// RUN: %run %t
> -
> -// Hooks are not implemented for lsan.
> -// XFAIL: lsan
> -
> -#include <string.h>
> -#include <assert.h>
> -
> -bool seen_memcmp, seen_strncmp, seen_strncasecmp, seen_strcmp,
> seen_strcasecmp,
> -    seen_strstr, seen_strcasestr, seen_memmem;
> -
> -extern "C" {
> -void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1,
> -                                  const void *s2, size_t n, int result) {
> -  seen_memcmp = true;
> -}
> -void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1,
> -                                   const char *s2, size_t n, int result) {
> -  seen_strncmp = true;
> -}
> -void __sanitizer_weak_hook_strncasecmp(void *called_pc, const char *s1,
> -                                       const char *s2, size_t n, int
> result){
> -  seen_strncasecmp = true;
> -}
> -void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1,
> -                                  const char *s2, int result){
> -  seen_strcmp = true;
> -}
> -void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1,
> -                                      const char *s2, int result){
> -  seen_strcasecmp = true;
> -}
> -void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1,
> -                                  const char *s2, char *result){
> -  seen_strstr = true;
> -}
> -void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1,
> -                                      const char *s2, char *result){
> -  seen_strcasestr = true;
> -}
> -void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t
> len1,
> -                                  const void *s2, size_t len2, void
> *result){
> -  seen_memmem = true;
> -}
> -} // extern "C"
> -
> -char s1[] = "ABCDEF";
> -char s2[] = "CDE";
> -
> -static volatile int int_sink;
> -static volatile void *ptr_sink;
> -
> -int main() {
> -  assert(sizeof(s2) < sizeof(s1));
> -
> -  int_sink = memcmp(s1, s2, sizeof(s2));
> -  assert(seen_memcmp);
> -
> -  int_sink = strncmp(s1, s2, sizeof(s2));
> -  assert(seen_strncmp);
> -
> -  int_sink = strncasecmp(s1, s2, sizeof(s2));
> -  assert(seen_strncasecmp);
> -
> -  int_sink = strcmp(s1, s2);
> -  assert(seen_strcmp);
> -
> -  int_sink = strcasecmp(s1, s2);
> -  assert(seen_strcasecmp);
> -
> -  ptr_sink = strstr(s1, s2);
> -  assert(seen_strstr);
> -
> -  ptr_sink = strcasestr(s1, s2);
> -  assert(seen_strcasestr);
> -
> -  ptr_sink = memmem(s1, sizeof(s1), s2, sizeof(s2));
> -  assert(seen_memmem);
> -  return 0;
> -}
>
> Copied:
> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc
> (from r293734,
> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc)
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc&p1=compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/weak_hook_test.cc&r1=293734&r2=293741&rev=293741&view=diff
>
> ==============================================================================
>     (empty)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-- 
Mike
Sent from phone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170202/7d622f0c/attachment.html>


More information about the llvm-commits mailing list