1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/lib/Transforms
Evgeniy Stepanov 4e2f26d080 [hwasan] Stack instrumentation.
Summary:
Very basic stack instrumentation using tagged pointers.
Tag for N'th alloca in a function is built as XOR of:
 * base tag for the function, which is just some bits of SP (poor
   man's random)
 * small constant which is a function of N.

Allocas are aligned to 16 bytes. On every ReturnInst allocas are
re-tagged to catch use-after-return.

This implementation has a bunch of issues that will be taken care of
later:
1. lifetime intrinsics referring to tagged pointers are not
   recognized in SDAG. This effectively disables stack coloring.
2. Generated code is quite inefficient. There is one extra
   instruction at each memory access that adds the base tag to the
   untagged alloca address. It would be better to keep tagged SP in a
   callee-saved register and address allocas as an offset of that XOR
   retag, but that needs better coordination between hwasan
   instrumentation pass and prologue/epilogue insertion.
3. Lifetime instrinsics are ignored and use-after-scope is not
   implemented. This would be harder to do than in ASan, because we
   need to use a differently tagged pointer depending on which
   lifetime.start / lifetime.end the current instruction is dominated
   / post-dominated.

Reviewers: kcc, alekseyshl

Subscribers: srhines, kubamracek, javed.absar, hiraditya, llvm-commits

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

llvm-svn: 322324
2018-01-11 22:53:30 +00:00
..
Coroutines Make internal/private GVs implicitly dso_local. 2018-01-11 22:15:05 +00:00
Hello
InstCombine [InstCombine] Apply the fix from r322284 for sin / cos -> tan too 2018-01-11 15:33:21 +00:00
Instrumentation [hwasan] Stack instrumentation. 2018-01-11 22:53:30 +00:00
IPO Make internal/private GVs implicitly dso_local. 2018-01-11 22:15:05 +00:00
ObjCARC Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
Scalar [Sink] Really really fix predicate in legality check 2018-01-11 21:28:57 +00:00
Utils [InstCombine] Missed optimization in math expression: sin(x) / cos(x) => tan(x) 2018-01-11 06:33:00 +00:00
Vectorize Add explanatory comment to LoadStoreVectorizer. 2018-01-10 03:02:12 +00:00
CMakeLists.txt
LLVMBuild.txt