[PATCH] D63877: Avoid infinite loop with asan interception

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 15:09:42 PDT 2019


yln added inline comments.


================
Comment at: compiler-rt/lib/interception/interception_linux.cc:49
     // RTLD_DEFAULT.
     addr = dlsym(RTLD_DEFAULT, name);
+
----------------
Do we understand why we need still want the pointer, even if we don't intercept functions? Or is the comment wrong?
https://reviews.llvm.org/D39779

I intended to change `InterceptFunction` to return true only on when "interception was successful", but I missed this case here.
> If the lookup using RTLD_NEXT failed ...  we cannot intercept this function.
Currently, we still return true, because we got an address `addr && (func == wrapper)`.

The original patch added a test that checks:
```
// Tests that ubsan can detect errors on Android if libc appears before the
// runtime in the library search order, which means that we cannot intercept
// symbols.
```
It's not obvious to me why we need to lookup the pointer if none of our interceptors run!?


================
Comment at: compiler-rt/test/asan/TestCases/dlopen-mixed-c-cxx.c:5
+//
+// CHECK: AddressSanitizer CHECK failed
+#ifdef __cplusplus
----------------
Which check fails here?
Ideally, it would be this one: https://github.com/llvm/llvm-project/blob/29d05c005fa88b3a59697a2e538f46cf79413548/compiler-rt/lib/asan/asan_interceptors.h#L126


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63877/new/

https://reviews.llvm.org/D63877





More information about the llvm-commits mailing list