[PATCH] D39124: Add NetBSD improvements in sanitizers

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 09:26:54 PDT 2017


dvyukov added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:4422
+  COMMON_INTERCEPTOR_READ_STRING(ctx, name, 0);
+  COMMON_INTERCEPTOR_SET_PTHREAD_NAME(ctx, thread, name, arg);
+  return REAL(pthread_setname_np)(thread, name, arg);
----------------
krytarowski wrote:
> krytarowski wrote:
> > dvyukov wrote:
> > > COMMON_INTERCEPTOR_* is interface with the rest of the system (asan, tsan, msan, lsan, ...). It _must_ be platform-independent. We don't want gazillion of OS/arch-specific details plague rest of the codebase. See how you now need to update all of asan/tsan/msan (and forgot esan/esan_interceptors.cpp).
> > > Keep the interface as it is now and handle NetBSDs-specific difference in NetBSDs-specific interceptor. Namely, do the printf here and pass formatted name to COMMON_INTERCEPTOR_SET_PTHREAD_NAME.
> > Unless esan will be simple to be ported, it will wait for finishing LLDB.
> > 
> > Right now lsan isn't possible due to `StopTheWorld()` OS capability requirements.  I plan to introduce a new `ptrace(2)` API to self-introspect in the future. But this must wait for finishing `ptrace(2)`/signals/etc correctness for debuggers (there are few bugs out there).
> > 
> > I'm going to research this NetBSD-specific interceptor.
> I'm not sure I understand correctly the suggestion, but I think I need to partially revert to the previous state and reintroduce internal_snprintf() into `SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP` again.
I mean that even if we split the interceptor itself into netbsd/!netbsd versions, they both should call the SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP with the same arguments, so that the rest of the system is not affected by the difference. Then you don't need to touch this in asan/tsan/msan (and esan).


Repository:
  rL LLVM

https://reviews.llvm.org/D39124





More information about the llvm-commits mailing list