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*5ffd83dbSDimitry AndricUBSAN_CHECK(NullPointerUseWithNullability, "null-pointer-use", 22*5ffd83dbSDimitry Andric "nullability-assign") 2368d75effSDimitry AndricUBSAN_CHECK(NullptrWithOffset, "nullptr-with-offset", "pointer-overflow") 2468d75effSDimitry AndricUBSAN_CHECK(NullptrWithNonZeroOffset, "nullptr-with-nonzero-offset", 2568d75effSDimitry Andric "pointer-overflow") 2668d75effSDimitry AndricUBSAN_CHECK(NullptrAfterNonZeroOffset, "nullptr-after-nonzero-offset", 2768d75effSDimitry Andric "pointer-overflow") 280b57cec5SDimitry AndricUBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow") 290b57cec5SDimitry AndricUBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment") 300b57cec5SDimitry AndricUBSAN_CHECK(AlignmentAssumption, "alignment-assumption", "alignment") 310b57cec5SDimitry AndricUBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size") 320b57cec5SDimitry AndricUBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow", 330b57cec5SDimitry Andric "signed-integer-overflow") 340b57cec5SDimitry AndricUBSAN_CHECK(UnsignedIntegerOverflow, "unsigned-integer-overflow", 350b57cec5SDimitry Andric "unsigned-integer-overflow") 360b57cec5SDimitry AndricUBSAN_CHECK(IntegerDivideByZero, "integer-divide-by-zero", 370b57cec5SDimitry Andric "integer-divide-by-zero") 380b57cec5SDimitry AndricUBSAN_CHECK(FloatDivideByZero, "float-divide-by-zero", "float-divide-by-zero") 390b57cec5SDimitry AndricUBSAN_CHECK(InvalidBuiltin, "invalid-builtin-use", "invalid-builtin-use") 40*5ffd83dbSDimitry AndricUBSAN_CHECK(InvalidObjCCast, "invalid-objc-cast", "invalid-objc-cast") 410b57cec5SDimitry AndricUBSAN_CHECK(ImplicitUnsignedIntegerTruncation, 420b57cec5SDimitry Andric "implicit-unsigned-integer-truncation", 430b57cec5SDimitry Andric "implicit-unsigned-integer-truncation") 440b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncation, 450b57cec5SDimitry Andric "implicit-signed-integer-truncation", 460b57cec5SDimitry Andric "implicit-signed-integer-truncation") 470b57cec5SDimitry AndricUBSAN_CHECK(ImplicitIntegerSignChange, 480b57cec5SDimitry Andric "implicit-integer-sign-change", 490b57cec5SDimitry Andric "implicit-integer-sign-change") 500b57cec5SDimitry AndricUBSAN_CHECK(ImplicitSignedIntegerTruncationOrSignChange, 510b57cec5SDimitry Andric "implicit-signed-integer-truncation-or-sign-change", 520b57cec5SDimitry Andric "implicit-signed-integer-truncation,implicit-integer-sign-change") 530b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftBase, "invalid-shift-base", "shift-base") 540b57cec5SDimitry AndricUBSAN_CHECK(InvalidShiftExponent, "invalid-shift-exponent", "shift-exponent") 550b57cec5SDimitry AndricUBSAN_CHECK(OutOfBoundsIndex, "out-of-bounds-index", "bounds") 560b57cec5SDimitry AndricUBSAN_CHECK(UnreachableCall, "unreachable-call", "unreachable") 570b57cec5SDimitry AndricUBSAN_CHECK(MissingReturn, "missing-return", "return") 580b57cec5SDimitry AndricUBSAN_CHECK(NonPositiveVLAIndex, "non-positive-vla-index", "vla-bound") 590b57cec5SDimitry AndricUBSAN_CHECK(FloatCastOverflow, "float-cast-overflow", "float-cast-overflow") 600b57cec5SDimitry AndricUBSAN_CHECK(InvalidBoolLoad, "invalid-bool-load", "bool") 610b57cec5SDimitry AndricUBSAN_CHECK(InvalidEnumLoad, "invalid-enum-load", "enum") 620b57cec5SDimitry AndricUBSAN_CHECK(FunctionTypeMismatch, "function-type-mismatch", "function") 630b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullReturn, "invalid-null-return", 640b57cec5SDimitry Andric "returns-nonnull-attribute") 65*5ffd83dbSDimitry AndricUBSAN_CHECK(InvalidNullReturnWithNullability, "invalid-null-return", 66*5ffd83dbSDimitry Andric "nullability-return") 670b57cec5SDimitry AndricUBSAN_CHECK(InvalidNullArgument, "invalid-null-argument", "nonnull-attribute") 68*5ffd83dbSDimitry AndricUBSAN_CHECK(InvalidNullArgumentWithNullability, "invalid-null-argument", 69*5ffd83dbSDimitry Andric "nullability-arg") 700b57cec5SDimitry AndricUBSAN_CHECK(DynamicTypeMismatch, "dynamic-type-mismatch", "vptr") 710b57cec5SDimitry AndricUBSAN_CHECK(CFIBadType, "cfi-bad-type", "cfi") 72