[PATCH] D26177: [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding)

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 17:49:28 PDT 2016


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, rnk.
kubabrecka added subscribers: llvm-commits, zaks.anna.
kubabrecka set the repository for this revision to rL LLVM.
kubabrecka added a project: Sanitizers.

This patch is a re-incarnation of https://reviews.llvm.org/D10740 (which seems to be abandoned now).  This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms.  Otherwise the shadow stack gets corrupted (leaked).  There is an existing implementation that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

I moved the implementation of EscapeEnumerator to a header file, but note that I made one change, which is the addition of the `II->setDebugLoc(CI->getDebugLoc());` line.  This makes sure we don't lose debug information.


Repository:
  rL LLVM

https://reviews.llvm.org/D26177

Files:
  include/llvm/Transforms/Utils/EscapeEnumerator.h
  lib/CodeGen/ShadowStackGCLowering.cpp
  lib/Transforms/Instrumentation/ThreadSanitizer.cpp
  projects/compiler-rt/lib/tsan/rtl/tsan_rtl.cc
  projects/compiler-rt/test/tsan/exceptions.cc
  projects/compiler-rt/test/tsan/test.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26177.76509.patch
Type: text/x-patch
Size: 16325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161101/9042163a/attachment.bin>


More information about the llvm-commits mailing list