[PATCH] D19761: [safestack] Support safestack_call_for_usp attribute

Michael LeMay via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 16:58:54 PDT 2016

mlemay-intel added a comment.

In https://reviews.llvm.org/D19761#575717, @eugenis wrote:

> Do you really need all this complexity, and even a magic function attribute (which is btw entirely safestack-specific, so should have "safestack" in the name)?

You're correct that there are simpler ways to handle runtime initialization.  I have been able to modify musl libc to successfully initialize based on this revised patch.  I also no longer need https://reviews.llvm.org/D19853.  I use -force-attribute instead.

> We've had the same problem on Android, and were able to solve it entirely on the libc side:
>  https://android-review.googlesource.com/#/c/170988/23/linker/linker_main.cpp

I'll try to move initialization of a basic thread control block containing the USP early enough in musl libc to avoid the need for this patch.  I'll report back after I've had a chance to try that.

> Alternatively, consider moving this code into a runtime library function. Then SafeStack instrumentation would just call a function in the prologue instead of reading from a global. This would be good for code size.

This revised patch uses the existing code that calls out to `__safestack_pointer_address`.


More information about the llvm-commits mailing list