Bug 1890277: part 2) Add `require-trusted-types-for` directive to CSP parser, guarded...
[gecko.git] / mfbt / TsanOptions.h
blobf276251038b84d2a29207d735124d97e1fdb0306
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* Default options for ThreadSanitizer. */
9 #ifndef mozilla_TsanOptions_h
10 #define mozilla_TsanOptions_h
12 #include "mozilla/Compiler.h"
14 #ifndef _MSC_VER // Not supported by clang-cl yet
17 // When running with ThreadSanitizer, we need to explicitly set some
18 // options specific to our codebase to prevent errors during runtime.
19 // To override these, set the TSAN_OPTIONS environment variable.
21 // Currently, these are:
23 // abort_on_error=1 - Causes TSan to abort instead of using exit().
24 // halt_on_error=1 - Causes TSan to stop on the first race detected.
26 // report_signal_unsafe=0 - Required to avoid TSan deadlocks when
27 // receiving external signals (e.g. SIGINT manually on console).
29 // allocator_may_return_null=1 - Tell TSan to return NULL when an allocation
30 // fails instead of aborting the program. This allows us to handle failing
31 // allocations the same way we would handle them with a regular allocator and
32 // also uncovers potential bugs that might occur in these situations.
34 extern "C" const char* __tsan_default_options() {
35 return "halt_on_error=1:abort_on_error=1:report_signal_unsafe=0"
36 ":allocator_may_return_null=1";
39 // These are default suppressions for external libraries that probably
40 // every application would want to include if it potentially loads external
41 // libraries like GTK/X and hence their dependencies.
42 # define MOZ_TSAN_DEFAULT_EXTLIB_SUPPRESSIONS \
43 "called_from_lib:libappmenu-gtk3-parser\n" \
44 "called_from_lib:libatk-1\n" \
45 "called_from_lib:libcairo.so\n" \
46 "called_from_lib:libcairo-gobject\n" \
47 "called_from_lib:libdconfsettings\n" \
48 "called_from_lib:libEGL_nvidia\n" \
49 "called_from_lib:libfontconfig.so\n" \
50 "called_from_lib:libfontconfig1\n" \
51 "called_from_lib:libgdk-3\n" \
52 "called_from_lib:libgdk_pixbuf\n" \
53 "called_from_lib:libgdk-x11\n" \
54 "called_from_lib:libgio-2\n" \
55 "called_from_lib:libglib-1\n" \
56 "called_from_lib:libglib-2\n" \
57 "called_from_lib:libgobject\n" \
58 "called_from_lib:libgtk-3\n" \
59 "called_from_lib:libgtk-x11\n" \
60 "called_from_lib:libgvfscommon\n" \
61 "called_from_lib:libgvfsdbus\n" \
62 "called_from_lib:libibus-1\n" \
63 "called_from_lib:libnvidia-eglcore\n" \
64 "called_from_lib:libnvidia-glsi\n" \
65 "called_from_lib:libogg.so\n" \
66 "called_from_lib:libpango-1\n" \
67 "called_from_lib:libpangocairo\n" \
68 "called_from_lib:libpangoft2\n" \
69 "called_from_lib:pango-basic-fc\n" \
70 "called_from_lib:libpixman-1\n" \
71 "called_from_lib:libpulse.so\n" \
72 "called_from_lib:libpulsecommon\n" \
73 "called_from_lib:libsecret-1\n" \
74 "called_from_lib:libunity-gtk3-parser\n" \
75 "called_from_lib:libvorbis.so\n" \
76 "called_from_lib:libvorbisfile\n" \
77 "called_from_lib:libwayland-client\n" \
78 "called_from_lib:libX11.so\n" \
79 "called_from_lib:libX11-xcb\n" \
80 "called_from_lib:libXau\n" \
81 "called_from_lib:libxcb.so\n" \
82 "called_from_lib:libXcomposite\n" \
83 "called_from_lib:libXcursor\n" \
84 "called_from_lib:libXdamage\n" \
85 "called_from_lib:libXdmcp\n" \
86 "called_from_lib:libXext\n" \
87 "called_from_lib:libXfixes\n" \
88 "called_from_lib:libXi.so\n" \
89 "called_from_lib:libXrandr\n" \
90 "called_from_lib:libXrender\n" \
91 "called_from_lib:libXss\n"
93 #endif // _MSC_VER
95 #endif /* mozilla_TsanOptions_h */