Skip to content
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

ASan doesn't always set DYLD_INSERT_LIBRARIES correctly on OSX #159

Closed
ramosian-glider opened this issue Aug 31, 2015 · 4 comments
Closed

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 159

Example 1:

$ cat t.c
#include <unistd.h>
int main() {
  execl("/bin/bash", "/bin/bash", NULL);
}
$ bin/clang -fsanitize=address t.c -o t -g && ./t
dyld: Symbol not found: ___asan_mapping_offset
  Referenced from: /Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
  Expected in: flat namespace
 in /Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
Trace/BPT trap: 5

- i.e. we're still trying to preload the runtime library after exec().

Example 2:

$ cat f.c 
void foo() {}
$ bin/clang f.c -dynamiclib -o f.dylib
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
==13074== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==13074== to enable ASan wrappers.
==13074== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
==13074== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==13074== to enable ASan wrappers.
==13074== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
==13074== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==13074== to enable ASan wrappers.
==13074== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
==13074== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==13074== to enable ASan wrappers.
==13074== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
==13074== DYLD_INSERT_LIBRARIES=/Users/glider/src/asan/llvm/llvm_cmake_build/lib/clang/3.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==13074== to enable ASan wrappers.
==13074== Set ASAN_OPTIONS=allow_reexec=0 to disable this.
==13074== Parsed ASAN_OPTIONS: verbosity=1
==13074== exec()-ing the program with
...

- i.e. the application falls into an exec() loop.

Reported by ramosian.glider on 2013-02-13 13:55:22

@ramosian-glider
Copy link
Member Author

Example 2 fixed in Clang r175059.

Reported by ramosian.glider on 2013-02-13 17:53:41

@ramosian-glider
Copy link
Member Author

FTR, the missing invocation string for Example 2 is:
$ DYLD_INSERT_LIBRARIES=f.dylib ./t

Reported by ramosian.glider on 2013-02-15 16:02:52

@ramosian-glider
Copy link
Member Author

Fixed in Clang r175276.

Reported by ramosian.glider on 2013-02-15 16:13:40

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:40

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant