This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib from DYLD_INSERT_LIBRARIES
ClosedPublic

Authored by kubamracek on Nov 13 2017, 5:08 PM.

Details

Summary

On macOS, we usually don't require launching the target with DYLD_INSERT_LIBRARIES anymore. However, it is still necessary when running a target that is not instrumented (and e.g. dlopen's an instrument library later). In any case, ASan and TSan currently remove themselves from the DYLD_INSERT_LIBRARIES environment variable to avoid passing it onto children. This works well e.g. when instrumenting a shell. A problem arises when the target is a non-instrumented shim (e.g. "xcrun") that either re-execs or launches a child that is supposed to get DYLD_INSERT_LIBRARIES propagated. To support this mode, this patch introduces 'strip_env' flag that can be used to keep DYLD_INSERT_LIBRARIES untouched.

Diff Detail

Event Timeline

kubamracek created this revision.Nov 13 2017, 5:08 PM
fjricci accepted this revision.Nov 29 2017, 12:18 PM

Seems fine to me, and since nobody else has had any issue with it, I'll accept.

This revision is now accepted and ready to land.Nov 29 2017, 12:18 PM
This revision was automatically updated to reflect the committed changes.