[PATCH] D39935: [tsan] Fix signal chaining

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 17:04:51 PST 2017


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:2309
+    uptr cb = (uptr)old->sigaction;
+    if (cb == (uptr)rtl_sigaction || cb == (uptr)rtl_sighandler) {
+      internal_memcpy(old, &old_stored, sizeof(*old));
----------------
dvyukov wrote:
> vitalybuka wrote:
> > dvyukov wrote:
> > > I think we should at least zero old. Otherwise there is no way to distinguish when it's filled and when it's uninit garbage.
> > if (res != 0) it's OK to expect garbage there
> > if (res == 0) old contains whatever was installed without interceptor, and this is the point of the patch, to get Deadly Signal handler.
> > We install "Deadly Signal" handler using real sigaction to avoid "allow_user_segv_handler" flag check in interceptor.
> > if (res == 0) old contains whatever was installed without interceptor
> 
> This is not the case when cb != rtl_sigaction. We return 0 and leave garbage in old. Does libc ever return res=0 and garbage in old? If not, we should not too.
> 
if (res == 0 && cb != rtl_sigaction && cb != rtl_sighandler) "old" contains something that was set by REAL(sigaction)(sig, &newact, old) call above, which is not garbage.



Repository:
  rL LLVM

https://reviews.llvm.org/D39935





More information about the llvm-commits mailing list