This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/25114] New: RFE: Provide dlopen API(s) that allows caller to identify resolution scope (required by ASAN).
- From: "carlos at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 18 Oct 2019 21:14:06 +0000
- Subject: [Bug dynamic-link/25114] New: RFE: Provide dlopen API(s) that allows caller to identify resolution scope (required by ASAN).
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=25114
Bug ID: 25114
Summary: RFE: Provide dlopen API(s) that allows caller to
identify resolution scope (required by ASAN).
Product: glibc
Version: 2.31
Status: NEW
Severity: normal
Priority: P2
Component: dynamic-link
Assignee: unassigned at sourceware dot org
Reporter: carlos at redhat dot com
Target Milestone: ---
The ASAN interposer for dlopen cannot accurately interpose dlopen because when
it itself calls dlopen the dynamic loader considers ASAN to be the caller and
the scope resolution for loading the library starts there. Instead what you
want is for ASAN to be able to call dlopen but with the search scope of the
library it is interposing, which may not even be known. Either way, we need
some new kind of API here.
The following example shows the situation:
#include <dlfcn.h>
#include <iostream>
int main()
{
void *handle = dlopen("libb.so", RTLD_NOW);
if (handle == NULL) {
std::cout << "Failed to load libb.so" << std::endl;
}
}
#mkdir lib
#g++ --sanitize=address -Wl,-rpath='$ORIGIN/lib' -Wl,--enable-new-dtags -ldl -o
main main.cpp
#cd lib;
Create libb.so:
int foo()
{
return 1;
}
g++ -fPIC -shared b.C -o libb.so
Actual results:
strace ./main 2>&1 | grep libb.so
open("/opt/rh/devtoolset-6/root/usr/lib/../lib64/tls/libb.so",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
:
<snipped>
:
open("/usr/lib64/libb.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or
directory)
write(1, "Failed to load libb.so\n", 23Failed to load libb.so
Expected results:
strace ./main 2>&1 | grep libb.so
open("/opt/rh/devtoolset-6/root/usr/lib64/tls/libb.so", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/root/cc/lib/libb.so", O_RDONLY) = 3
--
You are receiving this mail because:
You are on the CC list for the bug.