This is an archive of the discontinued LLVM Phabricator instance.

[asan] Fix dyld version detection on OS X
ClosedPublic

Authored by kubamracek on Aug 3 2015, 6:46 AM.

Details

Summary

We currently have a dyld check in DyldNeedsEnvVariable that detects whether we are on a new OS X (10.11+) where we don't need to re-exec. For iOS simulator, we have a dlsym() hack that checks for a specific symbol, but this turns out to be fragile and problematic, because dlsym can sometimes call malloc(), which is not a good idea this early in the process runtime.

Let's instead of this do a direct comparison of dyld's version, which is exported in a public symbol dyldVersionNumber.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 31228.Aug 3 2015, 6:46 AM
kubamracek retitled this revision from to [asan] Fix dyld version detection on OS X.
kubamracek updated this object.
kubamracek added reviewers: samsonov, glider, kcc.
kubamracek added subscribers: llvm-commits, samsonov, glider and 2 others.
glider accepted this revision.Aug 3 2015, 7:37 AM
glider edited edge metadata.

LGTM

lib/asan/asan_mac.cc
108

Nit: spare newline?

This revision is now accepted and ready to land.Aug 3 2015, 7:37 AM
This revision was automatically updated to reflect the committed changes.

Could someone check this: https://github.com/google/sanitizers/issues/669 ? Seems to be caused by this patch.