Backed out changeset 0a133d5fd155 (bug 1864534) for causing screenshot related failur...
[gecko.git] / mozglue / build / TsanOptions.cpp
blob99e4a9380700c5de0a2cab4de9972468a81f8406
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "mozilla/Attributes.h"
7 #include "mozilla/TsanOptions.h"
9 #ifndef _MSC_VER // Not supported by clang-cl yet
12 // When running with ThreadSanitizer, we sometimes need to suppress existing
13 // races. However, in any case, it should be either because
15 // 1) a bug is on file. In this case, the bug number should always be
16 // included with the suppression.
18 // or 2) this is an intentional race. Please be very careful with judging
19 // races as intentional and benign. Races in C++ are undefined behavior
20 // and compilers increasingly rely on exploiting this for optimizations.
21 // Hence, many seemingly benign races cause harmful or unexpected
22 // side-effects.
24 // See also:
25 // https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong
28 // Also, when adding any race suppressions here, make sure to always add
29 // a signature for each of the two race stacks. Sometimes, TSan fails to
30 // symbolize one of the two traces and this can cause suppressed races to
31 // show up intermittently.
33 // clang-format off
34 extern "C" const char* __tsan_default_suppressions() {
35 return "# Add your suppressions below\n"
37 // External uninstrumented libraries
38 MOZ_TSAN_DEFAULT_EXTLIB_SUPPRESSIONS
40 // TSan internals
41 "race:__tsan::ProcessPendingSignals\n"
42 "race:__tsan::CallUserSignalHandler\n"
48 // Uninstrumented code causing false positives
50 // These libraries are uninstrumented and cause mutex false positives.
51 // However, they can be unloaded by GTK early which we cannot avoid.
52 "mutex:libGL.so\n"
53 "mutex:libGLdispatch\n"
54 "mutex:libGLX\n"
55 // Bug 1637707 - permanent
56 "mutex:libEGL_mesa.so\n"
57 // ~GLContextGLX unlocks a libGL mutex.
58 "mutex:GLContextGLX::~GLContextGLX\n"
59 // Bug 1825171
60 "mutex:libffi.so\n"
61 "mutex:wl_registry_destroy\n"
62 // Bug 1824768
63 "mutex:libdbus-1\n"
64 "mutex:swrast_dri.so\n"
65 // Bug 1651446 - permanent (ffmpeg)
66 "race:libavcodec.so*\n"
67 "race:libavutil.so*\n"
68 // For some reason, the suppressions on libpulse.so
69 // through `called_from_lib` only work partially.
70 "race:libpulse.so\n"
71 "race:pa_context_suspend_source_by_index\n"
72 "race:pa_context_unref\n"
73 "race:pa_format_info_set_prop_string_array\n"
74 "race:pa_stream_get_index\n"
75 "race:pa_stream_update_timing_info\n"
76 "race:vorbis_synthesis_init\n"
77 // This is a callback from libglib-2 that is apparently
78 // not fully suppressed through `called_from_lib`.
79 "race:g_main_context_dispatch\n"
80 // This is likely a false positive involving a mutex from GTK.
81 // See also bug 1642653 - permanent.
82 "mutex:GetMaiAtkType\n"
83 // Bug 1688716 - Failure due to fire_glxtest_process
84 // calling into uninstrumented external graphics driver code.
85 // For example: iris_dri.so and swrast_dri.so.
86 "race:fire_glxtest_process\n"
87 "race:iris_dri\n"
88 // Bug 1824768
89 "race:libLLVM-12\n"
90 "race:radeonsi_dri\n"
91 // Bug 1722721 - WebRender using uninstrumented Mesa drivers
92 "race:swrast_dri.so\n"
93 // Bug 1825171
94 "race:libffi.so\n"
95 "race:mozilla::widget::WaylandBuffer::BufferReleaseCallbackHandler\n"
100 // Deadlock reports on single-threaded runtime.
102 // This is a known false positive from TSan where it reports
103 // a potential deadlock even though all mutexes are only
104 // taken by a single thread. For applications/tasks where we
105 // are absolutely sure that no second thread will be involved
106 // we should suppress these issues.
108 // See also https://github.com/google/sanitizers/issues/488
110 // Bug 1614605 - permanent
111 "deadlock:SanctionsTestServer\n"
112 "deadlock:OCSPStaplingServer\n"
113 // Bug 1643087 - permanent
114 "deadlock:BadCertAndPinningServer\n"
115 // Bug 1606804 - permanent
116 "deadlock:cert_storage::SecurityState::open_db\n"
117 "deadlock:cert_storage::SecurityState::add_certs\n"
118 // Bug 1651770 - permanent
119 "deadlock:mozilla::camera::LockAndDispatch\n"
120 // Bug 1606804 - permanent
121 "deadlock:third_party/rust/rkv/src/env.rs\n"
122 // Bug 1680655 - permanent
123 "deadlock:EncryptedClientHelloServer\n"
124 // Bug 1682861 - permanent
125 "deadlock:nsDOMWindowUtils::CompareCanvases\n"
131 // Benign races in third-party code (should be fixed upstream)
133 // No Bug - permanent
134 // No Upstream Bug Filed!
136 // SIMD Initialization in libjpeg, potentially runs
137 // initialization twice, but otherwise benign. Init
138 // routine itself is in native assembler.
139 "race:init_simd\n"
140 "race:simd_support\n"
141 "race:jsimd_can_ycc_rgb\n"
142 // Bug 1615228 - permanent
143 // No Upstream Bug Filed!
145 // Likely benign race in ipc/chromium/ where we set
146 // `message_loop_` to `NULL` on two threads when stopping
147 // a thread at the same time it is already finishing.
148 "race:base::Thread::Stop\n"
149 // Bug 1615569 - permanent
150 // No Upstream Bug Filed!
152 // NSS is using freebl from two different threads but freebl isn't
153 // that threadsafe.
154 "race:mp_exptmod.max_window_bits\n"
155 // Bug 1652499 - permanent
156 // No Upstream Bug Filed!
158 // Likely benign race in webrtc.org code - race while updating the
159 // minimum log severity.
160 "race:Loggable\n"
161 "race:UpdateMinLogSeverity\n"
162 // Bug 1652174 - permanent
163 // Upstream Bug: https://github.com/libevent/libevent/issues/777
165 // Likely benign write-write race in libevent to set a sticky boolean
166 // flag to true.
167 "race:event_debug_mode_too_late\n"
169 // Bug 1653618 - permanent
170 // Upstream Bug: https://github.com/sctplab/usrsctp/issues/507
172 // Might lead to scheduled timers in libusrsctp getting dropped?
173 "race:sctp_handle_tick\n"
174 "race:sctp_handle_sack\n"
175 // Bug 1648604 - permanent
176 // Upstream Bug: https://github.com/sctplab/usrsctp/issues/482
178 // Likely benign race in libusrsctp allocator during a free.
179 "race:system_base_info\n"
180 // Benign lock-order-inversion in libusrsctp
181 // No upstream bug filed!
182 "deadlock:sctp_add_to_readq\n"
184 // Bug 1153409 - permanent
185 // No Upstream Bug Filed!
187 // Probably benign - sqlite has a few optimizations where it does
188 // racy reads and then does properly synchronized integrity checks
189 // afterwards. Some concern of compiler optimizations messing this
190 // up due to "volatile" being too weak for this.
191 "race:third_party/sqlite3/*\n"
192 "deadlock:third_party/sqlite3/*\n"
193 // Bug 1674770 - permanent
194 // Upstream Bug: https://github.com/Amanieu/parking_lot/issues/257
196 // parking_lot using incorrect atomic orderings in RwLock, upstream
197 // fix already up for review.
198 "race:StrongRuleNode::ensure_child\n"
199 // No Bug - permanent
200 // Upstream Bugs:
202 // * https://github.com/rayon-rs/rayon/issues/812
203 // * https://github.com/crossbeam-rs/crossbeam/issues/589
205 // Probably a false-positive from crossbeam's deque not being
206 // understood by tsan.
207 "race:crossbeam_deque*::resize\n"
208 "race:crossbeam_deque*::push\n"
209 "race:crossbeam_deque*::write\n"
210 "race:crossbeam_deque*::read\n"
211 "race:crossbeam_deque*::steal\n"
212 // Bug 1805819 - permanent
213 // No Upstream Bug Filed!
215 // False positive in libc's tzset_internal
216 // See https://crbug.com/379738 also
217 "race:tzset_internal\n"
223 // The rest of these suppressions are miscellaneous issues in gecko
224 // that should be investigated and ideally fixed.
226 // Bug 1671574 - Permanent
227 // The StartupCache thread intentionally races with the main thread to
228 // trigger OS-level paging. It is never joined with the main thread.
229 "thread:StartupCache\n"
231 // Bug 1734262 - Permanent
232 // When spawning async processes, we create a helper thread to wait for
233 // the process to terminate in order to asynchronously report the exit
234 // code to Gecko. This thread waits on a syscall for the process to end,
235 // which means there's no easy way to cancel and join it during Gecko
236 // shutdown. Suppress thread leak reports for this thread.
237 "thread:CreateMonitorThread\n"
239 // Bug 1601600
240 "race:SkARGB32_Blitter\n"
241 "race:SkARGB32_Shader_Blitter\n"
242 "race:SkARGB32_Opaque_Blitter\n"
243 "race:SkRasterPipelineBlitter\n"
244 "race:Clamp_S32_D32_nofilter_trans_shaderproc\n"
245 "race:SkSpriteBlitter_Memcpy\n"
247 // Bug 1606800
248 "race:CallInitFunc\n"
250 // Bug 1606803
251 "race:ipv6_is_present\n"
253 // Bug 1615123
254 "race:_dl_deallocate_tls\n"
255 "race:__libc_memalign\n"
257 // Bug 1664803
258 "race:Sampler::sSigHandlerCoordinator\n"
260 // Bug 1656068
261 "race:WebRtcAec_Create\n"
263 // No Bug - Logging bug in Mochitests
264 "race:mochitest/ssltunnel/ssltunnel.cpp\n"
266 // This thread does not seem to be stopped/joined.
267 // ImageBridgeChild should be turned back into a background
268 // task queue in bug 1647628, in which case these suppressions
269 // can be removed.
270 "race:mozilla::layers::ImageBridgeChild::ShutDown\n"
272 // Bug 1652530
273 "mutex:XErrorTrap\n"
275 // Bug 1671601
276 "race:CamerasParent::ActorDestroy\n"
277 "race:CamerasParent::DispatchToVideoCaptureThread\n"
279 // Bug 1623541
280 "race:VRShMem::PullSystemState\n"
281 "race:VRShMem::PushSystemState\n"
282 "race:VRShMem::PullBrowserState\n"
283 "race:VRShMem::PushBrowserState\n"
285 // Bug 1682951
286 "race:storage::Connection::Release\n"
288 // Bug 1683357
289 "race:image::ImageSurfaceCache::SuggestedSizeInternal\n"
290 "race:image::RasterImage::SetMetadata\n"
291 "race:image::RasterImage::GetWidth\n"
293 // Bug 1722721 - This is a benign race creating worker/SW compositor threads.
294 "race:webrender::profiler::register_thread\n"
296 // Bug 1722721 - This is a false positive during SW-WR rendering.
297 "race:scale_blit\n"
299 "race:mozilla::gl::MesaMemoryLeakWorkaround\n"
301 // Bug 1733908
302 "race:js::wasm::Code::bestTier\n"
303 "race:js::wasm::Code::commitTier2\n"
304 "race:js::wasm::Code::setTier2\n"
305 "race:js::wasm::Code::setAndBorrowTier2\n"
307 // Bug 1755449
308 // The Glean init thread is used to perform I/O and other blocking operations.
309 // It is never joined with the main thread, but this is being re-evaluated.
310 "thread:glean::initialize\n"
312 // Bug 1822605 - permanent
313 // A race exists in libvulkan_lvp.so. This was previously addressed in bug
314 // 1816713. However, libvulkan_lvp.so is unloaded so a called_from_lib
315 // suppression cannot be used.
316 "race:libvulkan_lvp.so\n"
318 // End of suppressions.
319 ; // Please keep this semicolon.
321 // clang-format on
322 #endif // _MSC_VER