[PATCH] D39124: Add NetBSD improvements in sanitizers

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 09:13:05 PDT 2017


krytarowski 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:
> 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D39124





More information about the llvm-commits mailing list