1 //===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the options for specifying which runtime sanitizers to
11 // enable. Users of this file must define the SANITIZER macro to make use of
12 // this information. Users of this file can also define the SANITIZER_GROUP
13 // macro to get information on options which refer to sets of sanitizers.
15 //===----------------------------------------------------------------------===//
18 #error "Define SANITIZER prior to including this file!"
21 // SANITIZER(NAME, ID)
23 // The first value is the name of the sanitizer as a string. The sanitizer can
24 // be enabled by specifying -fsanitize=NAME.
26 // The second value is an identifier which can be used to refer to the
30 // SANITIZER_GROUP(NAME, ID, ALIAS)
32 // The first two values have the same semantics as the corresponding SANITIZER
33 // values. The third value is an expression ORing together the IDs of individual
34 // sanitizers in this group.
36 #ifndef SANITIZER_GROUP
37 #define SANITIZER_GROUP(NAME, ID, ALIAS)
42 SANITIZER("address", Address)
44 // Kernel AddressSanitizer (KASan)
45 SANITIZER("kernel-address", KernelAddress)
48 SANITIZER("memory", Memory)
51 SANITIZER("thread", Thread)
54 SANITIZER("leak", Leak)
56 // UndefinedBehaviorSanitizer
57 SANITIZER("alignment", Alignment)
58 SANITIZER("array-bounds", ArrayBounds)
59 SANITIZER("bool", Bool)
60 SANITIZER("enum", Enum)
61 SANITIZER("float-cast-overflow", FloatCastOverflow)
62 SANITIZER("float-divide-by-zero", FloatDivideByZero)
63 SANITIZER("function", Function)
64 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
65 SANITIZER("nonnull-attribute", NonnullAttribute)
66 SANITIZER("null", Null)
67 SANITIZER("object-size", ObjectSize)
68 SANITIZER("return", Return)
69 SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
70 SANITIZER("shift-base", ShiftBase)
71 SANITIZER("shift-exponent", ShiftExponent)
72 SANITIZER_GROUP("shift", Shift, ShiftBase | ShiftExponent)
73 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
74 SANITIZER("unreachable", Unreachable)
75 SANITIZER("vla-bound", VLABound)
76 SANITIZER("vptr", Vptr)
79 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
82 SANITIZER("dataflow", DataFlow)
84 // Control Flow Integrity
85 SANITIZER("cfi-cast-strict", CFICastStrict)
86 SANITIZER("cfi-derived-cast", CFIDerivedCast)
87 SANITIZER("cfi-icall", CFIICall)
88 SANITIZER("cfi-unrelated-cast", CFIUnrelatedCast)
89 SANITIZER("cfi-nvcall", CFINVCall)
90 SANITIZER("cfi-vcall", CFIVCall)
91 SANITIZER_GROUP("cfi", CFI,
92 CFIDerivedCast | CFIICall | CFIUnrelatedCast | CFINVCall |
96 SANITIZER("safe-stack", SafeStack)
98 // -fsanitize=undefined includes all the sanitizers which have low overhead, no
99 // ABI or address space layout implications, and only catch undefined behavior.
100 SANITIZER_GROUP("undefined", Undefined,
101 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
102 FloatDivideByZero | IntegerDivideByZero | NonnullAttribute |
103 Null | ObjectSize | Return | ReturnsNonnullAttribute |
104 Shift | SignedIntegerOverflow | Unreachable | VLABound |
107 // -fsanitize=undefined-trap is an alias for -fsanitize=undefined.
108 SANITIZER_GROUP("undefined-trap", UndefinedTrap, Undefined)
110 SANITIZER_GROUP("integer", Integer,
111 SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
114 SANITIZER("local-bounds", LocalBounds)
115 SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
117 // EfficiencySanitizer
118 SANITIZER("efficiency-cache-frag", EfficiencyCacheFrag)
119 SANITIZER("efficiency-working-set", EfficiencyWorkingSet)
120 // Meta-group only used internally.
121 SANITIZER_GROUP("efficiency-all", Efficiency,
122 EfficiencyCacheFrag | EfficiencyWorkingSet)
124 // Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
125 // can be used to disable all the sanitizers.
126 SANITIZER_GROUP("all", All, ~0ULL)
129 #undef SANITIZER_GROUP