ubsan_checks.inc 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. // UBSAN_CHECK(Name, SummaryKind, FSanitizeFlagName)
  16. // SummaryKind and FSanitizeFlagName should be string literals.
  17. UBSAN_CHECK(GenericUB, "undefined-behavior", "undefined")
  18. UBSAN_CHECK(NullPointerUse, "null-pointer-use", "null")
  19. UBSAN_CHECK(NullPointerUseWithNullability, "null-pointer-use",
  20. "nullability-assign")
  21. UBSAN_CHECK(NullptrWithOffset, "nullptr-with-offset", "pointer-overflow")
  22. UBSAN_CHECK(NullptrWithNonZeroOffset, "nullptr-with-nonzero-offset",
  23. "pointer-overflow")
  24. UBSAN_CHECK(NullptrAfterNonZeroOffset, "nullptr-after-nonzero-offset",
  25. "pointer-overflow")
  26. UBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow")
  27. UBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment")
  28. UBSAN_CHECK(AlignmentAssumption, "alignment-assumption", "alignment")
  29. UBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size")
  30. UBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow",
  31. "signed-integer-overflow")
  32. UBSAN_CHECK(UnsignedIntegerOverflow, "unsigned-integer-overflow",
  33. "unsigned-integer-overflow")
  34. UBSAN_CHECK(IntegerDivideByZero, "integer-divide-by-zero",
  35. "integer-divide-by-zero")
  36. UBSAN_CHECK(FloatDivideByZero, "float-divide-by-zero", "float-divide-by-zero")
  37. UBSAN_CHECK(InvalidBuiltin, "invalid-builtin-use", "invalid-builtin-use")
  38. UBSAN_CHECK(InvalidObjCCast, "invalid-objc-cast", "invalid-objc-cast")
  39. UBSAN_CHECK(ImplicitUnsignedIntegerTruncation,
  40. "implicit-unsigned-integer-truncation",
  41. "implicit-unsigned-integer-truncation")
  42. UBSAN_CHECK(ImplicitSignedIntegerTruncation,
  43. "implicit-signed-integer-truncation",
  44. "implicit-signed-integer-truncation")
  45. UBSAN_CHECK(ImplicitIntegerSignChange,
  46. "implicit-integer-sign-change",
  47. "implicit-integer-sign-change")
  48. UBSAN_CHECK(ImplicitSignedIntegerTruncationOrSignChange,
  49. "implicit-signed-integer-truncation-or-sign-change",
  50. "implicit-signed-integer-truncation,implicit-integer-sign-change")
  51. UBSAN_CHECK(InvalidShiftBase, "invalid-shift-base", "shift-base")
  52. UBSAN_CHECK(InvalidShiftExponent, "invalid-shift-exponent", "shift-exponent")
  53. UBSAN_CHECK(OutOfBoundsIndex, "out-of-bounds-index", "bounds")
  54. UBSAN_CHECK(UnreachableCall, "unreachable-call", "unreachable")
  55. UBSAN_CHECK(MissingReturn, "missing-return", "return")
  56. UBSAN_CHECK(NonPositiveVLAIndex, "non-positive-vla-index", "vla-bound")
  57. UBSAN_CHECK(FloatCastOverflow, "float-cast-overflow", "float-cast-overflow")
  58. UBSAN_CHECK(InvalidBoolLoad, "invalid-bool-load", "bool")
  59. UBSAN_CHECK(InvalidEnumLoad, "invalid-enum-load", "enum")
  60. UBSAN_CHECK(FunctionTypeMismatch, "function-type-mismatch", "function")
  61. UBSAN_CHECK(InvalidNullReturn, "invalid-null-return",
  62. "returns-nonnull-attribute")
  63. UBSAN_CHECK(InvalidNullReturnWithNullability, "invalid-null-return",
  64. "nullability-return")
  65. UBSAN_CHECK(InvalidNullArgument, "invalid-null-argument", "nonnull-attribute")
  66. UBSAN_CHECK(InvalidNullArgumentWithNullability, "invalid-null-argument",
  67. "nullability-arg")
  68. UBSAN_CHECK(DynamicTypeMismatch, "dynamic-type-mismatch", "vptr")
  69. UBSAN_CHECK(CFIBadType, "cfi-bad-type", "cfi")