[hwasan] Record and display stack history in stack-based reports.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Mon, 24 Sep 2018 23:03:34 +0000 (23:03 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Mon, 24 Sep 2018 23:03:34 +0000 (23:03 +0000)
commit090f0f950451daeca08aa8e6df6c90c7a18a893c
treeba875de1e7745a895bc0198eeee0d2e7155b95ec
parent20c4999e8b365a6db6f41f2a562c42c54029554f
[hwasan] Record and display stack history in stack-based reports.

Summary:
Display a list of recent stack frames (not a stack trace!) when
tag-mismatch is detected on a stack address.

The implementation uses alignment tricks to get both the address of
the history buffer, and the base address of the shadow with a single
8-byte load. See the comment in hwasan_thread_list.h for more
details.

Developed in collaboration with Kostya Serebryany.

Reviewers: kcc

Subscribers: srhines, kubamracek, mgorny, hiraditya, jfb, llvm-commits

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

llvm-svn: 342923
21 files changed:
compiler-rt/lib/hwasan/CMakeLists.txt
compiler-rt/lib/hwasan/hwasan.cc
compiler-rt/lib/hwasan/hwasan.h
compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cc
compiler-rt/lib/hwasan/hwasan_flags.inc
compiler-rt/lib/hwasan/hwasan_linux.cc
compiler-rt/lib/hwasan/hwasan_report.cc
compiler-rt/lib/hwasan/hwasan_thread.cc
compiler-rt/lib/hwasan/hwasan_thread.h
compiler-rt/lib/hwasan/hwasan_thread_list.cc [new file with mode: 0644]
compiler-rt/lib/hwasan/hwasan_thread_list.h [new file with mode: 0644]
compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h
compiler-rt/lib/sanitizer_common/tests/sanitizer_ring_buffer_test.cc
compiler-rt/test/hwasan/TestCases/deep-recursion.c [new file with mode: 0644]
compiler-rt/test/hwasan/TestCases/rich-stack.c [new file with mode: 0644]
compiler-rt/test/hwasan/TestCases/stack-history-length.c [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll
llvm/test/Instrumentation/HWAddressSanitizer/basic.ll
llvm/test/Instrumentation/HWAddressSanitizer/prologue.ll [new file with mode: 0644]
llvm/test/Instrumentation/HWAddressSanitizer/with-ifunc.ll [deleted file]