diff options
author | Serge Guelton <sguelton@redhat.com> | 2019-07-20 13:00:12 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@redhat.com> | 2019-07-20 13:00:12 +0000 |
commit | 7a3d4c15a7fc647abeee0322f2de9aab1caa837e (patch) | |
tree | 0599bd8817572b10f164abbf206aa4ad5edd5c2d /compiler-rt | |
parent | 0a7faa4e3d9ff9f8eebc8be6a85123c5e5f50103 (diff) | |
download | bcm5719-llvm-7a3d4c15a7fc647abeee0322f2de9aab1caa837e.tar.gz bcm5719-llvm-7a3d4c15a7fc647abeee0322f2de9aab1caa837e.zip |
Revert "Fix asan infinite loop on undefined symbol"
This reverts commit cbd28cd05bb11e9d76d71c6cc2d38d89dbb1fe1a.
Buildbot fail: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/22434/steps/64-bit%20check-asan-dynamic/
llvm-svn: 366634
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/interception/interception_linux.cc | 9 | ||||
-rw-r--r-- | compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c | 43 |
2 files changed, 2 insertions, 50 deletions
diff --git a/compiler-rt/lib/interception/interception_linux.cc b/compiler-rt/lib/interception/interception_linux.cc index 4b27102a159..d07f060b5b6 100644 --- a/compiler-rt/lib/interception/interception_linux.cc +++ b/compiler-rt/lib/interception/interception_linux.cc @@ -33,7 +33,7 @@ static int StrCmp(const char *s1, const char *s2) { } #endif -static void *GetFuncAddr(const char *name, uptr wrapper_addr) { +static void *GetFuncAddr(const char *name) { #if SANITIZER_NETBSD // FIXME: Find a better way to handle renames if (StrCmp(name, "sigaction")) @@ -47,18 +47,13 @@ static void *GetFuncAddr(const char *name, uptr wrapper_addr) { // want the address of the real definition, though, so look it up using // RTLD_DEFAULT. addr = dlsym(RTLD_DEFAULT, name); - - // In case `name' is not loaded, dlsym ends up finding the actual wrapper. - // We don't want to intercept the wrapper and have it point to itself. - if ((uptr)addr == wrapper_addr) - addr = nullptr; } return addr; } bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func, uptr wrapper) { - void *addr = GetFuncAddr(name, wrapper); + void *addr = GetFuncAddr(name); *ptr_to_real = (uptr)addr; return addr && (func == wrapper); } diff --git a/compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c b/compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c deleted file mode 100644 index 30d50106ba4..00000000000 --- a/compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c +++ /dev/null @@ -1,43 +0,0 @@ -// RUN: %clangxx_asan -xc++ -shared -fPIC -o %t.so - < %s -// RUN: %clang_asan %s -o %t.out -ldl -// -// RUN: env ASAN_OPTIONS=verbosity=1 not %t.out %t.so 2>&1 | FileCheck %s -// -// CHECK: {{.*}}AddressSanitizer: failed to intercept '__cxa_{{.*}}throw{{.*}}' -// -// REQUIRES: x86_64-target-arch && !android - -#ifdef __cplusplus - -static void foo(void) { - int i = 0; - throw(i); -} - -extern "C" { -int bar(void); -}; -int bar(void) { - try { - foo(); - } catch (int i) { - return i; - } - return -1; -} - -#else - -#include <assert.h> -#include <dlfcn.h> - -int main(int argc, char **argv) { - int (*bar)(void); - void *handle = dlopen(argv[1], RTLD_LAZY); - assert(handle); - bar = dlsym(handle, "bar"); - assert(bar); - return bar(); -} - -#endif |