Fix GNU coding style for G_.
[official-gcc.git] / libsanitizer / asan / asan_flags.inc
blobb4253e025243aa49d853c2d7c844e3c8781e2238
1 //===-- asan_flags.inc ------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // ASan runtime flags.
9 //
10 //===----------------------------------------------------------------------===//
11 #ifndef ASAN_FLAG
12 # error "Define ASAN_FLAG prior to including this file!"
13 #endif
15 // ASAN_FLAG(Type, Name, DefaultValue, Description)
16 // See COMMON_FLAG in sanitizer_flags.inc for more details.
18 ASAN_FLAG(int, quarantine_size, -1,
19             "Deprecated, please use quarantine_size_mb.")
20 ASAN_FLAG(int, quarantine_size_mb, -1,
21           "Size (in Mb) of quarantine used to detect use-after-free "
22           "errors. Lower value may reduce memory usage but increase the "
23           "chance of false negatives.")
24 ASAN_FLAG(int, thread_local_quarantine_size_kb, -1,
25           "Size (in Kb) of thread local quarantine used to detect "
26           "use-after-free errors. Lower value may reduce memory usage but "
27           "increase the chance of false negatives. It is not advised to go "
28           "lower than 64Kb, otherwise frequent transfers to global quarantine "
29           "might affect performance.")
30 ASAN_FLAG(int, redzone, 16,
31           "Minimal size (in bytes) of redzones around heap objects. "
32           "Requirement: redzone >= 16, is a power of two.")
33 ASAN_FLAG(int, max_redzone, 2048,
34           "Maximal size (in bytes) of redzones around heap objects.")
35 ASAN_FLAG(
36     bool, debug, false,
37     "If set, prints some debugging information and does additional checks.")
38 ASAN_FLAG(
39     int, report_globals, 1,
40     "Controls the way to handle globals (0 - don't detect buffer overflow on "
41     "globals, 1 - detect buffer overflow, 2 - print data about registered "
42     "globals).")
43 ASAN_FLAG(bool, check_initialization_order, false,
44           "If set, attempts to catch initialization order issues.")
45 ASAN_FLAG(
46     bool, replace_str, true,
47     "If set, uses custom wrappers and replacements for libc string functions "
48     "to find more errors.")
49 ASAN_FLAG(bool, replace_intrin, true,
50           "If set, uses custom wrappers for memset/memcpy/memmove intrinsics.")
51 ASAN_FLAG(bool, detect_stack_use_after_return, false,
52           "Enables stack-use-after-return checking at run-time.")
53 ASAN_FLAG(int, min_uar_stack_size_log, 16, // We can't do smaller anyway.
54           "Minimum fake stack size log.")
55 ASAN_FLAG(int, max_uar_stack_size_log,
56           20, // 1Mb per size class, i.e. ~11Mb per thread
57           "Maximum fake stack size log.")
58 ASAN_FLAG(bool, uar_noreserve, false,
59           "Use mmap with 'noreserve' flag to allocate fake stack.")
60 ASAN_FLAG(
61     int, max_malloc_fill_size, 0x1000,  // By default, fill only the first 4K.
62     "ASan allocator flag. max_malloc_fill_size is the maximal amount of "
63     "bytes that will be filled with malloc_fill_byte on malloc.")
64 ASAN_FLAG(
65     int, max_free_fill_size, 0,
66     "ASan allocator flag. max_free_fill_size is the maximal amount of "
67     "bytes that will be filled with free_fill_byte during free.")
68 ASAN_FLAG(int, malloc_fill_byte, 0xbe,
69           "Value used to fill the newly allocated memory.")
70 ASAN_FLAG(int, free_fill_byte, 0x55,
71           "Value used to fill deallocated memory.")
72 ASAN_FLAG(bool, allow_user_poisoning, true,
73           "If set, user may manually mark memory regions as poisoned or "
74           "unpoisoned.")
75 ASAN_FLAG(
76     int, sleep_before_dying, 0,
77     "Number of seconds to sleep between printing an error report and "
78     "terminating the program. Useful for debugging purposes (e.g. when one "
79     "needs to attach gdb).")
80 ASAN_FLAG(
81     int, sleep_after_init, 0,
82     "Number of seconds to sleep after AddressSanitizer is initialized. "
83     "Useful for debugging purposes (e.g. when one needs to attach gdb).")
84 ASAN_FLAG(bool, check_malloc_usable_size, true,
85           "Allows the users to work around the bug in Nvidia drivers prior to "
86           "295.*.")
87 ASAN_FLAG(bool, unmap_shadow_on_exit, false,
88           "If set, explicitly unmaps the (huge) shadow at exit.")
89 ASAN_FLAG(bool, protect_shadow_gap, true, "If set, mprotect the shadow gap")
90 ASAN_FLAG(bool, print_stats, false,
91           "Print various statistics after printing an error message or if "
92           "atexit=1.")
93 ASAN_FLAG(bool, print_legend, true, "Print the legend for the shadow bytes.")
94 ASAN_FLAG(bool, print_scariness, false,
95           "Print the scariness score. Experimental.")
96 ASAN_FLAG(bool, atexit, false,
97           "If set, prints ASan exit stats even after program terminates "
98           "successfully.")
99 ASAN_FLAG(
100     bool, print_full_thread_history, true,
101     "If set, prints thread creation stacks for the threads involved in the "
102     "report and their ancestors up to the main thread.")
103 ASAN_FLAG(
104     bool, poison_heap, true,
105     "Poison (or not) the heap memory on [de]allocation. Zero value is useful "
106     "for benchmarking the allocator or instrumentator.")
107 ASAN_FLAG(bool, poison_partial, true,
108           "If true, poison partially addressable 8-byte aligned words "
109           "(default=true). This flag affects heap and global buffers, but not "
110           "stack buffers.")
111 ASAN_FLAG(bool, poison_array_cookie, true,
112           "Poison (or not) the array cookie after operator new[].")
114 // Turn off alloc/dealloc mismatch checker on Mac and Windows for now.
115 // https://github.com/google/sanitizers/issues/131
116 // https://github.com/google/sanitizers/issues/309
117 // TODO(glider,timurrrr): Fix known issues and enable this back.
118 ASAN_FLAG(bool, alloc_dealloc_mismatch,
119           !SANITIZER_MAC && !SANITIZER_WINDOWS && !SANITIZER_ANDROID,
120           "Report errors on malloc/delete, new/free, new/delete[], etc.")
122 ASAN_FLAG(bool, new_delete_type_mismatch, true,
123           "Report errors on mismatch between size of new and delete.")
124 ASAN_FLAG(
125     bool, strict_init_order, false,
126     "If true, assume that dynamic initializers can never access globals from "
127     "other modules, even if the latter are already initialized.")
128 ASAN_FLAG(
129     bool, start_deactivated, false,
130     "If true, ASan tweaks a bunch of other flags (quarantine, redzone, heap "
131     "poisoning) to reduce memory consumption as much as possible, and "
132     "restores them to original values when the first instrumented module is "
133     "loaded into the process. This is mainly intended to be used on "
134     "Android. ")
135 ASAN_FLAG(
136     int, detect_invalid_pointer_pairs, 0,
137     "If >= 2, detect operations like <, <=, >, >= and - on invalid pointer "
138     "pairs (e.g. when pointers belong to different objects); "
139     "If == 1, detect invalid operations only when both pointers are non-null.")
140 ASAN_FLAG(
141     bool, detect_container_overflow, true,
142     "If true, honor the container overflow annotations. See "
143     "https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow")
144 ASAN_FLAG(int, detect_odr_violation, 2,
145           "If >=2, detect violation of One-Definition-Rule (ODR); "
146           "If ==1, detect ODR-violation only if the two variables "
147           "have different sizes")
148 ASAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
149 ASAN_FLAG(bool, halt_on_error, true,
150           "Crash the program after printing the first error report "
151           "(WARNING: USE AT YOUR OWN RISK!)")
152 ASAN_FLAG(bool, use_odr_indicator, false,
153           "Use special ODR indicator symbol for ODR violation detection")
154 ASAN_FLAG(bool, allocator_frees_and_returns_null_on_realloc_zero, true,
155           "realloc(p, 0) is equivalent to free(p) by default (Same as the "
156           "POSIX standard). If set to false, realloc(p, 0) will return a "
157           "pointer to an allocated space which can not be used.")
158 ASAN_FLAG(bool, verify_asan_link_order, true,
159           "Check position of ASan runtime in library list (needs to be disabled"
160           " when other library has to be preloaded system-wide)")