sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not...
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 10 Nov 2017 22:09:37 +0000 (22:09 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 10 Nov 2017 22:09:37 +0000 (22:09 +0000)
commit0f43b92980b66b19f03779c5a9b701e377b67e08
treeeaa1b364cac701e816a47781093c3ce0a3a87a4c
parentada45dfde709b958c9fbed586e6ead45d0cd1c40
sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not work.

If the lookup using RTLD_NEXT failed, the sanitizer runtime library
is later in the library search order than the DSO that we are trying
to intercept, which means that we cannot intercept this function. We
still want the address of the real definition, though, so look it up
using RTLD_DEFAULT.

Differential Revision: https://reviews.llvm.org/D39779

llvm-svn: 317930
compiler-rt/lib/interception/interception_linux.cc
compiler-rt/test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c [new file with mode: 0644]
compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp [new file with mode: 0644]
compiler-rt/test/ubsan/lit.common.cfg