Skip to content

Commit 7f25b8f

Browse files
committed
Disable TSAN for rb_gc_mark_machine_context
Previously this was listed as a suppression, but we actually want this permanently unsanitized. This should be faster and more reliable since TASN won't have to match against symbolicated backtraces.
1 parent 3ad2019 commit 7f25b8f

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,7 @@ AC_CHECK_HEADERS(process.h)
13721372
AC_CHECK_HEADERS(pwd.h)
13731373
AC_CHECK_HEADERS(sanitizer/asan_interface.h)
13741374
AC_CHECK_HEADERS(sanitizer/msan_interface.h)
1375+
AC_CHECK_HEADERS(sanitizer/tsan_interface.h)
13751376
AC_CHECK_HEADERS(setjmpex.h)
13761377
AC_CHECK_HEADERS(stdalign.h)
13771378
AC_CHECK_HEADERS(stdio.h)

internal/sanitizers.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
# endif
3030
#endif
3131

32+
#ifdef HAVE_SANITIZER_TSAN_INTERFACE_H
33+
# if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
34+
# define RUBY_TSAN_ENABLED
35+
# include <sanitizer/tsan_interface.h>
36+
# endif
37+
#endif
38+
3239
#include "ruby/internal/stdbool.h" /* for bool */
3340
#include "ruby/ruby.h" /* for VALUE */
3441

@@ -42,6 +49,9 @@
4249
#elif defined(RUBY_MSAN_ENABLED)
4350
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
4451
__attribute__((__no_sanitize__("memory"), __noinline__)) x
52+
#elif defined(RUBY_TSAN_ENABLED)
53+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
54+
__attribute__((__no_sanitize__("thread"), __noinline__)) x
4555
#elif defined(NO_SANITIZE_ADDRESS)
4656
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
4757
NO_SANITIZE_ADDRESS(NOINLINE(x))

misc/tsan_suppressions.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ race_top:encoded_iseq_trace_instrument
104104
race:rb_iseq_trace_set_all
105105
race:rb_tracepoint_enable
106106

107-
# We walk the machine stack looking for markable objects, a thread with the GVL
108-
# released could by mutating the stack with non-Ruby-objects
109-
race:rb_gc_mark_machine_context
110-
111107
# GC enable/disable flag modifications race with object allocation flag reads
112108
race_top:rb_gc_impl_gc_disable
113109
race_top:rb_gc_impl_gc_enable

0 commit comments

Comments
 (0)