llvm-project/llvm/lib/Transforms/Instrumentation
Evgeniy Stepanov 99fa3e774d [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
..
AddressSanitizer.cpp Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
BoundsChecking.cpp [PM] Port BoundsChecking to the new PM. 2017-11-14 01:30:04 +00:00
CFGMST.h [PGO] add MST min edge selection heuristic to ensure non-zero entry count 2017-12-18 17:56:19 +00:00
CMakeLists.txt Hardware-assisted AddressSanitizer (llvm part). 2017-12-09 00:21:41 +00:00
DataFlowSanitizer.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-21 00:57:46 +00:00
EfficiencySanitizer.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
GCOVProfiling.cpp Disable gcov instrumentation of functions using funclet-based exception handling 2017-10-13 13:49:15 +00:00
HWAddressSanitizer.cpp [hwasan] Stack instrumentation. 2018-01-11 22:53:30 +00:00
IndirectCallPromotion.cpp [PGO] Make indirect call promotion a utility 2017-12-06 21:22:54 +00:00
InstrProfiling.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
Instrumentation.cpp Hardware-assisted AddressSanitizer (llvm part). 2017-12-09 00:21:41 +00:00
LLVMBuild.txt
MaximumSpanningTree.h Remove unneeded use of #undef DEBUG_TYPE. NFC 2017-07-12 20:49:21 +00:00
MemorySanitizer.cpp [MSan] Hotfix compilation 2017-12-11 15:48:56 +00:00
PGOInstrumentation.cpp Split IndirectBr critical edges before PGO gen/use passes. 2017-12-12 19:07:43 +00:00
PGOMemOPSizeOpt.cpp [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
SanitizerCoverage.cpp [sanitizer-coverage] call appendToUsed once per module, not once per function (which is too slow) 2017-09-09 05:30:13 +00:00
ThreadSanitizer.cpp Enhance synchscope representation 2017-07-11 22:23:00 +00:00