This is an archive of the discontinued LLVM Phabricator instance.

[safestack] Turn the OS X SafeStack runtime into a dynamic library
AcceptedPublic

Authored by kubamracek on Dec 3 2015, 7:49 AM.

Details

Summary

On OS X, the are two huge drawbacks to having a static library (.a) as a runtime:

  1. Interceptors don't work -- and SafeStack relies on intercepting pthread_create.
  2. Having multiple instrumented modules (frameworks, dylibs, bundles) in a single process is problematic and requires special care when building each module.

Let's make the runtime a dynamic library, just like the other sanitizers (ASan, TSan).

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 41756.Dec 3 2015, 7:49 AM
kubamracek retitled this revision from to [safestack] Turn the OS X SafeStack runtime into a dynamic library.
kubamracek updated this object.
kubamracek added reviewers: eugenis, pcc, kcc, samsonov.
kubamracek added subscribers: llvm-commits, zaks.anna.
samsonov added inline comments.Dec 3 2015, 10:48 AM
tools/clang/lib/Driver/Tools.cpp
6963

How do you address this now?

kubamracek added inline comments.Dec 3 2015, 10:52 AM
tools/clang/lib/Driver/Tools.cpp
6963

We link against the SafeStack dylib (we depend on it), so its constructors will be run before any constructors of the instrumented module. This is only an issue with a static library, where the __safestack_init constructor is in the same module as instrumented code.

samsonov edited edge metadata.Dec 3 2015, 10:55 AM

I'm in favor of this change, but will let Peter or Evgeniy sign this off.

eugenis accepted this revision.Dec 3 2015, 10:56 AM
eugenis edited edge metadata.

I'm fine with this.

This revision is now accepted and ready to land.Dec 3 2015, 10:56 AM

Looks like patch was not committed.