-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libc independence on Linux #46
Comments
From [email protected] on February 24, 2009 08:28:54 this was PR 206369 |
From [email protected] on April 02, 2009 08:30:00 sscanf is problematic for portability: issue #36 and also for transparency: issue #105 |
From [email protected] on April 02, 2009 11:10:13 Is it possible to load two libc into the memory, one for application and one for DR? |
From [email protected] on April 02, 2009 12:39:42 since we need so little of libc we've always assumed through the years that having |
From [email protected] on April 02, 2009 13:28:45 DR itself might only need a minimal libc, but what I am worry about the client, which |
From [email protected] on April 07, 2009 13:55:01 yes, we're in agreement, you're echoing comment 4 from "but ..." |
From [email protected] on December 07, 2009 12:12:18 xref errno issues b/c we can no longer change libc's errno address: issue #238 xref private loader: issue #157 |
From [email protected] on October 19, 2010 07:30:05 On my system, the ld-linux.so did not create heap before initializing DynamoRIO. |
From [email protected] on April 10, 2012 19:11:23 I hit this issue while attempting to run an ASan-ified binary under DR. ASan intercepts memcpy and others by exporting its version of memcpy, which gets picked up by libdynamorio.so before we get to libc. ASan's memcpy fails a CHECK: AddrIsInMem() looks like: gdb gives this trace: Can you think of any good ways to avoid the interception, or do we have to define our own hidden memcpy, str*, etc symbols for libc independence? |
From [email protected] on April 10, 2012 19:15:17 What if we try env var ASAN_OPTIONS=replace_intrin=0:replace_str=0 |
From [email protected] on April 10, 2012 19:23:03 Thanks, that seems to get past this particular issue. Long term we'll still need to solve this. |
From [email protected] on April 12, 2012 07:35:17 Issue 728 has been merged into this issue. |
From [email protected] on July 11, 2012 12:28:05 Our list of libc imports is getting smaller: [rnk@wittenberg build]$ nm -D -u lib64/debug/libdynamorio.so Most of these we never actually use. dlopen&co are behind the -no_private_loader flag. abort, backtrace, execlp, remove, and some others are all for debugging, and I don't have good ways to test any changes I make to them. The environment and stdio related imports are actually used, and we'll need to cut them for early injection. At this point I can run dr_asan without any special ASAN_OPTIONS, but memmove might still be a problem. I missed that in my string CL ( r1458 ) because I just grepped for str. =P Owner: [email protected] |
From [email protected] on August 04, 2012 08:01:56 Here's the current list of imports: My plan is to make the dlfcn imports weak, so we can support -no_private_loader when using LD_PRELOAD. This still provides somewhat useful functionality, so I'd rather not break it completely. sqrt is for computing stddev. I'm not sure what to do here. I try to do a simple approximation. The rest are from stackdump.c. I have a patch to eliminate the abort, execlp, and remove imports. How do we feel about backtrace? Can we kill it off, along with KEEP_SYMBOLS_FOR_GLIBC backtrace? I've never been able to get it to work, and once we've moved off the loaded modules list, it probably won't work at all. We also have another problem in release builds: These __*_chk guys are slipping in because of transformations gcc makes. For example, when doing memcpy with an unknown length into a buffer of a known size, gcc will pass the known size to __memcpy_chk. Otherwise, the prototypes match, so I think we can just alias them to the un-checked versions. This is C and the caller cleans up args, so we should be OK. Not sure what's up with __ctype_tolower_loc. |
From [email protected] on November 15, 2012 12:59:40 This is basically fixed, except for -no_private_loader, which will never work, and special stats builds. Status: Verified |
From [email protected] on February 24, 2009 11:22:37
I did not yet remove these libc routines:
worried about, but for now only at init:
U dlclose@@GLIBC_2.0
U dlopen@@GLIBC_2.1
used only at init:
U fclose@@GLIBC_2.1
U feof@@GLIBC_2.0
U fgets@@GLIBC_2.0
U fopen@@GLIBC_2.1
U get_nprocs_conf@@GLIBC_2.0
used only for debugging but will likely be problematic:
U getchar@@GLIBC_2.0
U abort@@GLIBC_2.0
U execlp@@GLIBC_2.0
U remove@@GLIBC_2.0
do not use system calls (I did not verify though, just assuming):
U __environ@@GLIBC_2.0
U __udivdi3@@GLIBC_2.0
U __umoddi3@@GLIBC_2.0
U backtrace@@GLIBC_2.1
U backtrace_symbols_fd@@GLIBC_2.1
U dlerror@@GLIBC_2.0
U dlsym@@GLIBC_2.0
U getenv@@GLIBC_2.0
U memcpy@@GLIBC_2.0
U memmove@@GLIBC_2.0
U memset@@GLIBC_2.0
U rindex@@GLIBC_2.0
U setenv@@GLIBC_2.0
U sqrt@@GLIBC_2.0
U sscanf@@GLIBC_2.0
U stderr@@GLIBC_2.0
U stdout@@GLIBC_2.0
U strcasecmp@@GLIBC_2.0
U strchr@@GLIBC_2.0
U strcmp@@GLIBC_2.0
U strncasecmp@@GLIBC_2.0
U strncat@@GLIBC_2.0
U strncmp@@GLIBC_2.0
U strncpy@@GLIBC_2.0
U strstr@@GLIBC_2.0
U strtoul@@GLIBC_2.0
U tolower@@GLIBC_2.0
Note that we actually call dlclose at process exit which is potentially a
more fragile point then during init. Xref PR 308654 for a crash when we
call dlclose.
xref PR 204554: early injection on Linux, which relies on this case, and
for which we need to access env vars directly
xref glibc issues with binary compatibility: issue #36
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=46
The text was updated successfully, but these errors were encountered: