[PATCH] D45646: [tsan] Zero out the shadow memory for the stack and TLS in ThreadFinish
Dmitry Vyukov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 16 02:09:21 PDT 2018
dvyukov added a comment.
Two things that I don't like here:
1. This imposes cost of zeroing of up to 32MB (standard 8MB stack x 4x shadow) per thread creation/destruction for all OSes. Some programs create threads like insane.
2. I don't think this fixes the actual root cause, only makes it even harder to localize. Note that cur_thread_finalize already clears the shadow slot, so if pthread reuses stack/tls wholesale, then the slot should be zero already. However, tsan does not generally keep shadow clear (e.g. munmap does not clear shadow too, and most likely a bunch of other things). So if the slot reuses memory from a previous mmap, it will crash the same way.
I wonder if moving the slot to _meta_ shadow is the right things to do. We actually clear meta shadow on unmap. I don't see where we clear stack, but we should, otherwise we can leak lots of sync objects on stack.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D45646
More information about the llvm-commits
mailing list