[PATCH] D31630: [tsan] Detect races on modifying accesses in Swift code

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 17:28:56 PDT 2017


kubamracek updated this revision to Diff 94144.
kubamracek retitled this revision from "[tsan] WIP: Detect races on modifying accesses in Swift code" to "[tsan] Detect races on modifying accesses in Swift code".
kubamracek edited the summary of this revision.
kubamracek added a comment.

Updating the patch with a solution to address the problem described at https://groups.google.com/forum/#!topic/thread-sanitizer/r7HmBkKQiIw:

> There is a problem is that we often detect the race on the "regular" access (called from LLVM IR instrumentation), and we can't tell that this is a Swift-type race, because we don't store the information that the previous access way a sizeless, external memory access.  Currently, the __tsan_external_write API simply does `MemoryWrite(addr, kSizeLog8)`, so we track those accesses as 8-byte long, which is not really true.  We'd like to instead treat them as "sizeless".

This patch stores the external tag information in a fake stack frame in thr->shadow_stack, which is later retrieved during issue reporting.  I'm open to better suggestions.


https://reviews.llvm.org/D31630

Files:
  lib/tsan/rtl/tsan_debugging.cc
  lib/tsan/rtl/tsan_external.cc
  lib/tsan/rtl/tsan_report.cc
  lib/tsan/rtl/tsan_report.h
  lib/tsan/rtl/tsan_rtl.h
  lib/tsan/rtl/tsan_rtl_report.cc
  lib/tsan/rtl/tsan_suppressions.cc
  test/tsan/Darwin/external-swift.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31630.94144.patch
Type: text/x-patch
Size: 11564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170405/0c30457f/attachment.bin>


More information about the llvm-commits mailing list