Warning, /include/clang/Basic/Sanitizers.def is written in an unsupported language. File is not indexed.
0001 //===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the options for specifying which runtime sanitizers to
0010 // enable. Users of this file must define the SANITIZER macro to make use of
0011 // this information. Users of this file can also define the SANITIZER_GROUP
0012 // macro to get information on options which refer to sets of sanitizers.
0013 //
0014 //===----------------------------------------------------------------------===//
0015
0016 #ifndef SANITIZER
0017 #error "Define SANITIZER prior to including this file!"
0018 #endif
0019
0020 // SANITIZER(NAME, ID)
0021
0022 // The first value is the name of the sanitizer as a string. The sanitizer can
0023 // be enabled by specifying -fsanitize=NAME.
0024
0025 // The second value is an identifier which can be used to refer to the
0026 // sanitizer.
0027
0028
0029 // SANITIZER_GROUP(NAME, ID, ALIAS)
0030
0031 // The first two values have the same semantics as the corresponding SANITIZER
0032 // values. The third value is an expression ORing together the IDs of individual
0033 // sanitizers in this group.
0034
0035 #ifndef SANITIZER_GROUP
0036 #define SANITIZER_GROUP(NAME, ID, ALIAS)
0037 #endif
0038
0039
0040 // AddressSanitizer
0041 SANITIZER("address", Address)
0042
0043 // Requires AddressSanitizer
0044 SANITIZER("pointer-compare", PointerCompare)
0045
0046 // Requires AddressSanitizer
0047 SANITIZER("pointer-subtract", PointerSubtract)
0048
0049 // Kernel AddressSanitizer (KASan)
0050 SANITIZER("kernel-address", KernelAddress)
0051
0052 // Hardware-assisted AddressSanitizer
0053 SANITIZER("hwaddress", HWAddress)
0054
0055 // Kernel Hardware-assisted AddressSanitizer (KHWASan)
0056 SANITIZER("kernel-hwaddress", KernelHWAddress)
0057
0058 // A variant of AddressSanitizer using AArch64 MTE extension.
0059 SANITIZER("memtag-stack", MemtagStack)
0060 SANITIZER("memtag-heap", MemtagHeap)
0061 SANITIZER("memtag-globals", MemtagGlobals)
0062 SANITIZER_GROUP("memtag", MemTag, MemtagStack | MemtagHeap | MemtagGlobals)
0063
0064 // MemorySanitizer
0065 SANITIZER("memory", Memory)
0066
0067 // Kernel MemorySanitizer (KMSAN)
0068 SANITIZER("kernel-memory", KernelMemory)
0069
0070 // libFuzzer
0071 SANITIZER("fuzzer", Fuzzer)
0072
0073 // libFuzzer-required instrumentation, no linking.
0074 SANITIZER("fuzzer-no-link", FuzzerNoLink)
0075
0076 // TypeSanitizer
0077 SANITIZER("type", Type)
0078
0079 // ThreadSanitizer
0080 SANITIZER("thread", Thread)
0081
0082 // Numerical stability sanitizer.
0083 SANITIZER("numerical", NumericalStability)
0084
0085 // RealtimeSanitizer
0086 SANITIZER("realtime", Realtime)
0087
0088 // LeakSanitizer
0089 SANITIZER("leak", Leak)
0090
0091 // UndefinedBehaviorSanitizer
0092 SANITIZER("alignment", Alignment)
0093 SANITIZER("array-bounds", ArrayBounds)
0094 SANITIZER("bool", Bool)
0095 SANITIZER("builtin", Builtin)
0096 SANITIZER("enum", Enum)
0097 SANITIZER("float-cast-overflow", FloatCastOverflow)
0098 SANITIZER("float-divide-by-zero", FloatDivideByZero)
0099 SANITIZER("function", Function)
0100 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
0101 SANITIZER("nonnull-attribute", NonnullAttribute)
0102 SANITIZER("null", Null)
0103 SANITIZER("nullability-arg", NullabilityArg)
0104 SANITIZER("nullability-assign", NullabilityAssign)
0105 SANITIZER("nullability-return", NullabilityReturn)
0106 SANITIZER_GROUP("nullability", Nullability,
0107 NullabilityArg | NullabilityAssign | NullabilityReturn)
0108 SANITIZER("object-size", ObjectSize)
0109 SANITIZER("pointer-overflow", PointerOverflow)
0110 SANITIZER("return", Return)
0111 SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
0112 SANITIZER("shift-base", ShiftBase)
0113 SANITIZER("shift-exponent", ShiftExponent)
0114 SANITIZER_GROUP("shift", Shift, ShiftBase | ShiftExponent)
0115 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
0116 SANITIZER("unreachable", Unreachable)
0117 SANITIZER("vla-bound", VLABound)
0118 SANITIZER("vptr", Vptr)
0119
0120 // IntegerSanitizer
0121 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
0122 SANITIZER("unsigned-shift-base", UnsignedShiftBase)
0123
0124 // DataFlowSanitizer
0125 SANITIZER("dataflow", DataFlow)
0126
0127 // Control Flow Integrity
0128 SANITIZER("cfi-cast-strict", CFICastStrict)
0129 SANITIZER("cfi-derived-cast", CFIDerivedCast)
0130 SANITIZER("cfi-icall", CFIICall)
0131 SANITIZER("cfi-mfcall", CFIMFCall)
0132 SANITIZER("cfi-unrelated-cast", CFIUnrelatedCast)
0133 SANITIZER("cfi-nvcall", CFINVCall)
0134 SANITIZER("cfi-vcall", CFIVCall)
0135 SANITIZER_GROUP("cfi", CFI,
0136 CFIDerivedCast | CFIICall | CFIMFCall | CFIUnrelatedCast |
0137 CFINVCall | CFIVCall)
0138
0139 // Kernel Control Flow Integrity
0140 SANITIZER("kcfi", KCFI)
0141
0142 // Safe Stack
0143 SANITIZER("safe-stack", SafeStack)
0144
0145 // Shadow Call Stack
0146 SANITIZER("shadow-call-stack", ShadowCallStack)
0147
0148 // -fsanitize=undefined includes all the sanitizers which have low overhead, no
0149 // ABI or address space layout implications, and only catch undefined behavior.
0150 SANITIZER_GROUP("undefined", Undefined,
0151 Alignment | Bool | Builtin | ArrayBounds | Enum |
0152 FloatCastOverflow |
0153 IntegerDivideByZero | NonnullAttribute | Null | ObjectSize |
0154 PointerOverflow | Return | ReturnsNonnullAttribute | Shift |
0155 SignedIntegerOverflow | Unreachable | VLABound | Function |
0156 Vptr)
0157
0158 // -fsanitize=undefined-trap is an alias for -fsanitize=undefined.
0159 SANITIZER_GROUP("undefined-trap", UndefinedTrap, Undefined)
0160
0161 // ImplicitConversionSanitizer
0162 SANITIZER("implicit-unsigned-integer-truncation",
0163 ImplicitUnsignedIntegerTruncation)
0164 SANITIZER("implicit-signed-integer-truncation", ImplicitSignedIntegerTruncation)
0165 SANITIZER_GROUP("implicit-integer-truncation", ImplicitIntegerTruncation,
0166 ImplicitUnsignedIntegerTruncation |
0167 ImplicitSignedIntegerTruncation)
0168
0169 SANITIZER("implicit-integer-sign-change", ImplicitIntegerSignChange)
0170
0171 SANITIZER_GROUP("implicit-integer-arithmetic-value-change",
0172 ImplicitIntegerArithmeticValueChange,
0173 ImplicitIntegerSignChange | ImplicitSignedIntegerTruncation)
0174
0175 SANITIZER_GROUP("implicit-integer-conversion", ImplicitIntegerConversion,
0176 ImplicitIntegerArithmeticValueChange |
0177 ImplicitUnsignedIntegerTruncation)
0178
0179 // Implicit bitfield sanitizers
0180 SANITIZER("implicit-bitfield-conversion", ImplicitBitfieldConversion)
0181
0182 SANITIZER_GROUP("implicit-conversion", ImplicitConversion,
0183 ImplicitIntegerConversion |
0184 ImplicitBitfieldConversion)
0185
0186 SANITIZER_GROUP("integer", Integer,
0187 ImplicitIntegerConversion | IntegerDivideByZero | Shift |
0188 SignedIntegerOverflow | UnsignedIntegerOverflow |
0189 UnsignedShiftBase)
0190
0191 SANITIZER("objc-cast", ObjCCast)
0192
0193 SANITIZER("local-bounds", LocalBounds)
0194 SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
0195
0196 // Scudo hardened allocator
0197 SANITIZER("scudo", Scudo)
0198
0199 // Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
0200 // can be used to disable all the sanitizers.
0201 SANITIZER_GROUP("all", All, ~SanitizerMask())
0202
0203 #undef SANITIZER
0204 #undef SANITIZER_GROUP