[PATCH] D39935: [tsan] Fix signal chaining

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 00:06:25 PST 2017


dvyukov 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));
----------------
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.



Repository:
  rL LLVM

https://reviews.llvm.org/D39935





More information about the llvm-commits mailing list