[llvm-dev] Is shadow call stack in llvm 7 ok?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 22 06:22:13 PST 2018


Hi,

On Thu, 22 Nov 2018 at 09:00, PenYiWang via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> at 0x400577 the program crashes
>
> because  r11 is 0 after  0x400574 .

Looking at ShadowCallStack.cpp, the 0 is very intentional. So to use
this feature you'll need a runtime willing to give each thread a valid
shadow stack and set the base and of the gs register to point at it.

The documentation mentions that you'll probably have to write your own
runtime: https://clang.llvm.org/docs/ShadowCallStack.html. You didn't
mention which OS you were using, but these notes seem to cover what
would be needed to actually set GS on various platforms:
https://gist.github.com/MerryMage/f22e75d5128c07d77630ca01c4272937.

You'd have to come up with your own methods to make sure that happens
on each thread before any instrumented code runs.

Cheers.

Tim.


More information about the llvm-dev mailing list