Add the ShadowCallStack pass
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Wed, 4 Apr 2018 01:21:16 +0000 (01:21 +0000)
committerVlad Tsyrklevich <vlad@tsyrklevich.net>
Wed, 4 Apr 2018 01:21:16 +0000 (01:21 +0000)
commite3446017ed82fe7f3158c892d65eb4ded24bafe8
tree016ff644f00c309fca88de87a2a325ab9a41d7c1
parent086b1c8118430cd19f04e903df8ebcc00f6d924f
Add the ShadowCallStack pass

Summary:
The ShadowCallStack pass instruments functions marked with the
shadowcallstack attribute. The instrumented prolog saves the return
address to [gs:offset] where offset is stored and updated in [gs:0].
The instrumented epilog loads/updates the return address from [gs:0]
and checks that it matches the return address on the stack before
returning.

Reviewers: pcc, vitalybuka

Reviewed By: pcc

Subscribers: cryptoad, eugenis, craig.topper, mgorny, llvm-commits, kcc

Differential Revision: https://reviews.llvm.org/D44802

llvm-svn: 329139
llvm/lib/Target/X86/CMakeLists.txt
llvm/lib/Target/X86/ShadowCallStack.cpp [new file with mode: 0644]
llvm/lib/Target/X86/X86.h
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/X86/O0-pipeline.ll
llvm/test/CodeGen/X86/O3-pipeline.ll
llvm/test/CodeGen/X86/shadow-call-stack.mir [new file with mode: 0644]