This is an archive of the discontinued LLVM Phabricator instance.

Handle symbol renaming of sigaction for NetBSD
ClosedPublic

Authored by krytarowski on Nov 22 2017, 4:02 AM.

Details

Summary

NetBSD uses the __sigaction14 symbol name for historical and compat
reasons for the sigaction(2) function name.

Rename the interceptors and users of sigaction to sigaction_symname
and reuse it in the code base.

This change fixes 4 failing tests in TSan/NetBSD:

  • ThreadSanitizer-x86_64 :: signal_errno.cc
  • ThreadSanitizer-x86_64 :: signal_malloc.cc
  • ThreadSanitizer-x86_64 :: signal_sync2.cc
  • ThreadSanitizer-x86_64 :: signal_thread.cc

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Nov 22 2017, 4:02 AM

This patch has been tested only on NetBSD and with asan, msan, lsan, tsan, ubsan, libfuzzer, safestack, profile.

I request for a tester on Linux as it might have impact for e.g. esan.

dvyukov edited edge metadata.Nov 28 2017, 2:31 AM

This patch has been tested only on NetBSD and with asan, msan, lsan, tsan, ubsan, libfuzzer, safestack, profile.

I request for a tester on Linux as it might have impact for e.g. esan.

I've tested this patch on linux and all sanitizer tests have passed:

$ ninja check-tsan check-asan check-lsan check-msan check-esan check-sanitizer
[2/8] Running the LeakSanitizer tests
Testing Time: 9.29s
  Expected Passes    : 152
  Unsupported Tests  : 16
[3/8] Running sanitizer_common tests
Testing Time: 14.32s
  Expected Passes    : 701
  Expected Failures  : 34
  Unsupported Tests  : 55
[4/8] Running the AddressSanitizer tests
Testing Time: 31.81s
  Expected Passes    : 1471
  Expected Failures  : 2
  Unsupported Tests  : 297
[5/8] Running the MemorySanitizer tests
Testing Time: 6.58s
  Expected Passes    : 131
  Expected Failures  : 1
[6/8] Running ThreadSanitizer tests
Testing Time: 11.00s
  Expected Passes    : 303
  Expected Failures  : 1
  Unsupported Tests  : 75
2 warning(s) in tests.
[7/8] Running EfficiencySanitizer tests
Testing Time: 0.52s
  Expected Passes    : 10
  Unsupported Tests  : 3
dvyukov accepted this revision.Nov 28 2017, 2:31 AM
This revision is now accepted and ready to land.Nov 28 2017, 2:31 AM

Thanks! I've uploaded a slightly older diff, that has another renaming in sanitizer_signal_interceptors.inc. I will commit the newer version and check the remaining portability issues on buildbots.

@@ -25,7 +31,7 @@ using namespace __sanitizer;
 
 #ifndef SIGNAL_INTERCEPTOR_SIGACTION_IMPL
 #define SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact) \
-  { return REAL(sigaction)(signum, act, oldact); }
+  { return REAL(sigaction_symname)(signum, act, oldact); }
 #endif
 
 #if SANITIZER_INTERCEPT_BSD_SIGNAL
krytarowski closed this revision.Nov 28 2017, 2:55 AM