xref: /freebsd/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_checks.inc (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric//===-- ubsan_checks.inc ----------------------------------------*- C++ -*-===//
2*0b57cec5SDimitry Andric//
3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric//
7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric//
9*0b57cec5SDimitry Andric// List of checks handled by UBSan runtime.
10*0b57cec5SDimitry Andric//
11*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12*0b57cec5SDimitry Andric#ifndef UBSAN_CHECK
13*0b57cec5SDimitry Andric# error "Define UBSAN_CHECK prior to including this file!"
14*0b57cec5SDimitry Andric#endif
15*0b57cec5SDimitry Andric
16*0b57cec5SDimitry Andric// UBSAN_CHECK(Name, SummaryKind, FSanitizeFlagName)
17*0b57cec5SDimitry Andric// SummaryKind and FSanitizeFlagName should be string literals.
18*0b57cec5SDimitry Andric
19*0b57cec5SDimitry AndricUBSAN_CHECK(GenericUB, "undefined-behavior", "undefined")
20*0b57cec5SDimitry AndricUBSAN_CHECK(NullPointerUse, "null-pointer-use", "null")
21*0b57cec5SDimitry AndricUBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow")
22*0b57cec5SDimitry AndricUBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment")
23*0b57cec5SDimitry AndricUBSAN_CHECK(AlignmentAssumption, "alignment-assumption", "alignment")
24*0b57cec5SDimitry AndricUBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size")
25*0b57cec5SDimitry AndricUBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow",
26*0b57cec5SDimitry Andric            "signed-integer-overflow")
27*0b57cec5SDimitry AndricUBSAN_CHECK(UnsignedIntegerOverflow, "unsigned-integer-overflow",
28*0b57cec5SDimitry Andric            "unsigned-integer-overflow")
29*0b57cec5SDimitry AndricUBSAN_CHECK(IntegerDivideByZero, "integer-divide-by-zero",
30*0b57cec5SDimitry Andric            "integer-divide-by-zero")
31*0b57cec5SDimitry AndricUBSAN_CHECK(FloatDivideByZero, "float-divide-by-zero", "float-divide-by-zero")
32*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidBuiltin, "invalid-builtin-use", "invalid-builtin-use")
33*0b57cec5SDimitry AndricUBSAN_CHECK(ImplicitUnsignedIntegerTruncation,
34*0b57cec5SDimitry Andric            "implicit-unsigned-integer-truncation",
35*0b57cec5SDimitry Andric            "implicit-unsigned-integer-truncation")
36*0b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncation,
37*0b57cec5SDimitry Andric            "implicit-signed-integer-truncation",
38*0b57cec5SDimitry Andric            "implicit-signed-integer-truncation")
39*0b57cec5SDimitry AndricUBSAN_CHECK(ImplicitIntegerSignChange,
40*0b57cec5SDimitry Andric            "implicit-integer-sign-change",
41*0b57cec5SDimitry Andric            "implicit-integer-sign-change")
42*0b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncationOrSignChange,
43*0b57cec5SDimitry Andric            "implicit-signed-integer-truncation-or-sign-change",
44*0b57cec5SDimitry Andric            "implicit-signed-integer-truncation,implicit-integer-sign-change")
45*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftBase, "invalid-shift-base", "shift-base")
46*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftExponent, "invalid-shift-exponent", "shift-exponent")
47*0b57cec5SDimitry AndricUBSAN_CHECK(OutOfBoundsIndex, "out-of-bounds-index", "bounds")
48*0b57cec5SDimitry AndricUBSAN_CHECK(UnreachableCall, "unreachable-call", "unreachable")
49*0b57cec5SDimitry AndricUBSAN_CHECK(MissingReturn, "missing-return", "return")
50*0b57cec5SDimitry AndricUBSAN_CHECK(NonPositiveVLAIndex, "non-positive-vla-index", "vla-bound")
51*0b57cec5SDimitry AndricUBSAN_CHECK(FloatCastOverflow, "float-cast-overflow", "float-cast-overflow")
52*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidBoolLoad, "invalid-bool-load", "bool")
53*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidEnumLoad, "invalid-enum-load", "enum")
54*0b57cec5SDimitry AndricUBSAN_CHECK(FunctionTypeMismatch, "function-type-mismatch", "function")
55*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullReturn, "invalid-null-return",
56*0b57cec5SDimitry Andric            "returns-nonnull-attribute")
57*0b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullArgument, "invalid-null-argument", "nonnull-attribute")
58*0b57cec5SDimitry AndricUBSAN_CHECK(DynamicTypeMismatch, "dynamic-type-mismatch", "vptr")
59*0b57cec5SDimitry AndricUBSAN_CHECK(CFIBadType, "cfi-bad-type", "cfi")
60