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