This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Make the ASan OS X DYLD_INSERT_LIBRARIES detection path-independent
ClosedPublic

Authored by kubamracek on Nov 12 2014, 3:10 PM.

Details

Reviewers
glider
Summary

ASan on Darwin during launch reads DYLD_INSERT_LIBRARIES env. variable and if it's not set or if the ASan dylib is not present in there, it relaunches the process. The check whether the dylib is present in the variable is now trying to find a full path in there. This fails in the scenarios where we want to copy the dylib to the executable's directory or somewhere else and set the DYLD_INSERT_LIBRARIES manually, see http://reviews.llvm.org/D6018.

Let's change the search in DYLD_INSERT_LIBRARIES to only look for the filename of the dylib and not the full path.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 16119.Nov 12 2014, 3:10 PM
kubamracek retitled this revision from to [compiler-rt] Make the ASan OS X DYLD_INSERT_LIBRARIES detection path-independent.
kubamracek updated this object.
kubamracek edited the test plan for this revision. (Show Details)
kubamracek added subscribers: Unknown Object (MLST), glider, samsonov.
glider accepted this revision.Nov 18 2014, 12:48 AM
glider edited edge metadata.

LGTM

test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc
11

How do you make sure you do not reexec?
Maybe do that explicitly by running with verbosity=1?

This revision is now accepted and ready to land.Nov 18 2014, 12:48 AM
kubamracek updated this revision to Diff 16339.Nov 18 2014, 9:17 AM
kubamracek edited edge metadata.

Adding an explicit check whether we reexec using verbosity=1.

LGTM

test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc
5

Note: you can wrap long lines using '\'

Splitting long lines.

kubamracek closed this revision.Nov 18 2014, 5:32 PM

Landed in r222297.