[PATCH] D9600: Add scan-build python implementation

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 9 17:27:35 PST 2015


zaks.anna added a comment.

Hi Laszlo,


================
Comment at: tools/scan-build-py/libear/ear.c:281
@@ +280,3 @@
+
+    DLSYM(func, fp, "execve");
+
----------------
This is not the recommended way of interposing on Darwin. All you need to do is provide your function, which can call the function you are interposing on and tell the linker about it as described in this example:

http://www.opensource.apple.com/source/dyld/dyld-97.1/include/mach-o/dyld-interposing.h

You would only need to set DYLD_INSERT_LIBRARIES and would not need to require flat namespace. We should not be setting DYLD_FORCE_FLAT_NAMESPACE; some of the problems it causes are described on this thread: 

https://mikeash.com/pyblog/friday-qa-2009-01-30-code-injection.html

compiler-rt (sanitizers) also intercept on all platforms including Windows (see interception.h); that code is very platform dependent.


http://reviews.llvm.org/D9600





More information about the cfe-commits mailing list