xref: /freebsd/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_checks.inc (revision 68d75eff68281c1b445e3010bb975eae07aac225)
10b57cec5SDimitry Andric//===-- ubsan_checks.inc ----------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
90b57cec5SDimitry Andric// List of checks handled by UBSan runtime.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric#ifndef UBSAN_CHECK
130b57cec5SDimitry Andric# error "Define UBSAN_CHECK prior to including this file!"
140b57cec5SDimitry Andric#endif
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric// UBSAN_CHECK(Name, SummaryKind, FSanitizeFlagName)
170b57cec5SDimitry Andric// SummaryKind and FSanitizeFlagName should be string literals.
180b57cec5SDimitry Andric
190b57cec5SDimitry AndricUBSAN_CHECK(GenericUB, "undefined-behavior", "undefined")
200b57cec5SDimitry AndricUBSAN_CHECK(NullPointerUse, "null-pointer-use", "null")
21*68d75effSDimitry AndricUBSAN_CHECK(NullptrWithOffset, "nullptr-with-offset", "pointer-overflow")
22*68d75effSDimitry AndricUBSAN_CHECK(NullptrWithNonZeroOffset, "nullptr-with-nonzero-offset",
23*68d75effSDimitry Andric            "pointer-overflow")
24*68d75effSDimitry AndricUBSAN_CHECK(NullptrAfterNonZeroOffset, "nullptr-after-nonzero-offset",
25*68d75effSDimitry Andric            "pointer-overflow")
260b57cec5SDimitry AndricUBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow")
270b57cec5SDimitry AndricUBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment")
280b57cec5SDimitry AndricUBSAN_CHECK(AlignmentAssumption, "alignment-assumption", "alignment")
290b57cec5SDimitry AndricUBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size")
300b57cec5SDimitry AndricUBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow",
310b57cec5SDimitry Andric            "signed-integer-overflow")
320b57cec5SDimitry AndricUBSAN_CHECK(UnsignedIntegerOverflow, "unsigned-integer-overflow",
330b57cec5SDimitry Andric            "unsigned-integer-overflow")
340b57cec5SDimitry AndricUBSAN_CHECK(IntegerDivideByZero, "integer-divide-by-zero",
350b57cec5SDimitry Andric            "integer-divide-by-zero")
360b57cec5SDimitry AndricUBSAN_CHECK(FloatDivideByZero, "float-divide-by-zero", "float-divide-by-zero")
370b57cec5SDimitry AndricUBSAN_CHECK(InvalidBuiltin, "invalid-builtin-use", "invalid-builtin-use")
380b57cec5SDimitry AndricUBSAN_CHECK(ImplicitUnsignedIntegerTruncation,
390b57cec5SDimitry Andric            "implicit-unsigned-integer-truncation",
400b57cec5SDimitry Andric            "implicit-unsigned-integer-truncation")
410b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncation,
420b57cec5SDimitry Andric            "implicit-signed-integer-truncation",
430b57cec5SDimitry Andric            "implicit-signed-integer-truncation")
440b57cec5SDimitry AndricUBSAN_CHECK(ImplicitIntegerSignChange,
450b57cec5SDimitry Andric            "implicit-integer-sign-change",
460b57cec5SDimitry Andric            "implicit-integer-sign-change")
470b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncationOrSignChange,
480b57cec5SDimitry Andric            "implicit-signed-integer-truncation-or-sign-change",
490b57cec5SDimitry Andric            "implicit-signed-integer-truncation,implicit-integer-sign-change")
500b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftBase, "invalid-shift-base", "shift-base")
510b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftExponent, "invalid-shift-exponent", "shift-exponent")
520b57cec5SDimitry AndricUBSAN_CHECK(OutOfBoundsIndex, "out-of-bounds-index", "bounds")
530b57cec5SDimitry AndricUBSAN_CHECK(UnreachableCall, "unreachable-call", "unreachable")
540b57cec5SDimitry AndricUBSAN_CHECK(MissingReturn, "missing-return", "return")
550b57cec5SDimitry AndricUBSAN_CHECK(NonPositiveVLAIndex, "non-positive-vla-index", "vla-bound")
560b57cec5SDimitry AndricUBSAN_CHECK(FloatCastOverflow, "float-cast-overflow", "float-cast-overflow")
570b57cec5SDimitry AndricUBSAN_CHECK(InvalidBoolLoad, "invalid-bool-load", "bool")
580b57cec5SDimitry AndricUBSAN_CHECK(InvalidEnumLoad, "invalid-enum-load", "enum")
590b57cec5SDimitry AndricUBSAN_CHECK(FunctionTypeMismatch, "function-type-mismatch", "function")
600b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullReturn, "invalid-null-return",
610b57cec5SDimitry Andric            "returns-nonnull-attribute")
620b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullArgument, "invalid-null-argument", "nonnull-attribute")
630b57cec5SDimitry AndricUBSAN_CHECK(DynamicTypeMismatch, "dynamic-type-mismatch", "vptr")
640b57cec5SDimitry AndricUBSAN_CHECK(CFIBadType, "cfi-bad-type", "cfi")
65