[hwasan] Record and display stack history in stack-based reports.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Mon, 24 Sep 2018 21:38:42 +0000 (21:38 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Mon, 24 Sep 2018 21:38:42 +0000 (21:38 +0000)
commit9043e17eddc3ccc23914a0294e93ec8e03c7af3e
treeb3b1bc341115db8d1ac45cdcc381d12907330fdf
parent2a6deeb9288708ce8fb1d62a48823b8236f5251e
[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: 342921
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]