FreeBSD kernel kern code
kern_ubsan.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/limits.h>
#include <sys/systm.h>
#include <machine/_inttypes.h>
#include <machine/stdarg.h>
Include dependency graph for kern_ubsan.c:

Go to the source code of this file.

Data Structures

struct  CSourceLocation
 
struct  CTypeDescriptor
 
struct  COverflowData
 
struct  CUnreachableData
 
struct  CCFICheckFailData
 
struct  CDynamicTypeCacheMissData
 
struct  CFunctionTypeMismatchData
 
struct  CInvalidBuiltinData
 
struct  CInvalidValueData
 
struct  CNonNullArgData
 
struct  CNonNullReturnData
 
struct  COutOfBoundsData
 
struct  CPointerOverflowData
 
struct  CShiftOutOfBoundsData
 
struct  CTypeMismatchData
 
struct  CTypeMismatchData_v1
 
struct  CVLABoundData
 
struct  CFloatCastOverflowData
 
struct  CAlignmentAssumptionData
 

Macros

#define ASSERT(x)   KASSERT(x, ("%s: " __STRING(x) " failed", __func__))
 
#define __arraycount(x)   nitems(x)
 
#define ISSET(x, y)   ((x) & (y))
 
#define __BIT(x)   ((uintmax_t)1 << (uintmax_t)(x))
 
#define __LOWEST_SET_BIT(__mask)   ((((__mask) - 1) & (__mask)) ^ (__mask))
 
#define __SHIFTOUT(__x, __mask)   (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
 
#define REINTERPRET_CAST(__dt, __st)   ((__dt)(__st))
 
#define STATIC_CAST(__dt, __st)   ((__dt)(__st))
 
#define ACK_REPORTED   __BIT(31)
 
#define MUL_STRING   "*"
 
#define PLUS_STRING   "+"
 
#define MINUS_STRING   "-"
 
#define DIVREM_STRING   "divrem"
 
#define CFI_VCALL   0
 
#define CFI_NVCALL   1
 
#define CFI_DERIVEDCAST   2
 
#define CFI_UNRELATEDCAST   3
 
#define CFI_ICALL   4
 
#define CFI_NVMFCALL   5
 
#define CFI_VMFCALL   6
 
#define NUMBER_MAXLEN   128
 
#define LOCATION_MAXLEN   (PATH_MAX + 32 /* ':LINE:COLUMN' */)
 
#define WIDTH_8   8
 
#define WIDTH_16   16
 
#define WIDTH_32   32
 
#define WIDTH_64   64
 
#define WIDTH_80   80
 
#define WIDTH_96   96
 
#define WIDTH_128   128
 
#define NUMBER_SIGNED_BIT   1U
 
#define KIND_INTEGER   0
 
#define KIND_FLOAT   1
 
#define KIND_UNKNOWN   UINT16_MAX
 

Typedefs

typedef int64_t longest
 
typedef uint64_t ulongest
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void Report (bool isFatal, const char *pFormat,...) __printflike(2
 
static void static bool isAlreadyReported (struct CSourceLocation *pLocation)
 
static size_t zDeserializeTypeWidth (struct CTypeDescriptor *pType)
 
static void DeserializeLocation (char *pBuffer, size_t zBUfferLength, struct CSourceLocation *pLocation)
 
static void DeserializeNumberSigned (char *pBuffer, size_t zBUfferLength, struct CTypeDescriptor *pType, longest L)
 
static void DeserializeNumberUnsigned (char *pBuffer, size_t zBUfferLength, struct CTypeDescriptor *pType, ulongest L)
 
static longest llliGetNumber (char *szLocation, struct CTypeDescriptor *pType, unsigned long ulNumber)
 
static ulongest llluGetNumber (char *szLocation, struct CTypeDescriptor *pType, unsigned long ulNumber)
 
static void DeserializeNumber (char *szLocation, char *pBuffer, size_t zBUfferLength, struct CTypeDescriptor *pType, unsigned long ulNumber)
 
static const char * DeserializeTypeCheckKind (uint8_t hhuTypeCheckKind)
 
static const char * DeserializeBuiltinCheckKind (uint8_t hhuBuiltinCheckKind)
 
static const char * DeserializeCFICheckKind (uint8_t hhuCFICheckKind)
 
static bool isNegativeNumber (char *szLocation, struct CTypeDescriptor *pType, unsigned long ulNumber)
 
static bool isShiftExponentTooLarge (char *szLocation, struct CTypeDescriptor *pType, unsigned long ulNumber, size_t zWidth)
 
void __ubsan_handle_add_overflow (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_add_overflow_abort (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_alignment_assumption (struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset)
 
void __ubsan_handle_alignment_assumption_abort (struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset)
 
void __ubsan_handle_builtin_unreachable (struct CUnreachableData *pData)
 
void __ubsan_handle_cfi_bad_type (struct CCFICheckFailData *pData, unsigned long ulVtable, bool bValidVtable, bool FromUnrecoverableHandler, unsigned long ProgramCounter, unsigned long FramePointer)
 
void __ubsan_handle_cfi_check_fail (struct CCFICheckFailData *pData, unsigned long ulValue, unsigned long ulValidVtable)
 
void __ubsan_handle_cfi_check_fail_abort (struct CCFICheckFailData *pData, unsigned long ulValue, unsigned long ulValidVtable)
 
void __ubsan_handle_divrem_overflow (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_divrem_overflow_abort (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_dynamic_type_cache_miss (struct CDynamicTypeCacheMissData *pData, unsigned long ulPointer, unsigned long ulHash)
 
void __ubsan_handle_dynamic_type_cache_miss_abort (struct CDynamicTypeCacheMissData *pData, unsigned long ulPointer, unsigned long ulHash)
 
void __ubsan_handle_float_cast_overflow (struct CFloatCastOverflowData *pData, unsigned long ulFrom)
 
void __ubsan_handle_float_cast_overflow_abort (struct CFloatCastOverflowData *pData, unsigned long ulFrom)
 
void __ubsan_handle_function_type_mismatch (struct CFunctionTypeMismatchData *pData, unsigned long ulFunction)
 
void __ubsan_handle_function_type_mismatch_abort (struct CFunctionTypeMismatchData *pData, unsigned long ulFunction)
 
void __ubsan_handle_invalid_builtin (struct CInvalidBuiltinData *pData)
 
void __ubsan_handle_invalid_builtin_abort (struct CInvalidBuiltinData *pData)
 
void __ubsan_handle_load_invalid_value (struct CInvalidValueData *pData, unsigned long ulVal)
 
void __ubsan_handle_load_invalid_value_abort (struct CInvalidValueData *pData, unsigned long ulVal)
 
void __ubsan_handle_missing_return (struct CUnreachableData *pData)
 
void __ubsan_handle_mul_overflow (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_mul_overflow_abort (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_negate_overflow (struct COverflowData *pData, unsigned long ulOldVal)
 
void __ubsan_handle_negate_overflow_abort (struct COverflowData *pData, unsigned long ulOldVal)
 
void __ubsan_handle_nonnull_arg (struct CNonNullArgData *pData)
 
void __ubsan_handle_nonnull_arg_abort (struct CNonNullArgData *pData)
 
void __ubsan_handle_nonnull_return_v1 (struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer)
 
void __ubsan_handle_nonnull_return_v1_abort (struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer)
 
void __ubsan_handle_nullability_arg (struct CNonNullArgData *pData)
 
void __ubsan_handle_nullability_arg_abort (struct CNonNullArgData *pData)
 
void __ubsan_handle_nullability_return_v1 (struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer)
 
void __ubsan_handle_nullability_return_v1_abort (struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer)
 
void __ubsan_handle_out_of_bounds (struct COutOfBoundsData *pData, unsigned long ulIndex)
 
void __ubsan_handle_out_of_bounds_abort (struct COutOfBoundsData *pData, unsigned long ulIndex)
 
void __ubsan_handle_pointer_overflow (struct CPointerOverflowData *pData, unsigned long ulBase, unsigned long ulResult)
 
void __ubsan_handle_pointer_overflow_abort (struct CPointerOverflowData *pData, unsigned long ulBase, unsigned long ulResult)
 
void __ubsan_handle_shift_out_of_bounds (struct CShiftOutOfBoundsData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_shift_out_of_bounds_abort (struct CShiftOutOfBoundsData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_sub_overflow (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_sub_overflow_abort (struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
void __ubsan_handle_type_mismatch (struct CTypeMismatchData *pData, unsigned long ulPointer)
 
void __ubsan_handle_type_mismatch_abort (struct CTypeMismatchData *pData, unsigned long ulPointer)
 
void __ubsan_handle_type_mismatch_v1 (struct CTypeMismatchData_v1 *pData, unsigned long ulPointer)
 
void __ubsan_handle_type_mismatch_v1_abort (struct CTypeMismatchData_v1 *pData, unsigned long ulPointer)
 
void __ubsan_handle_vla_bound_not_positive (struct CVLABoundData *pData, unsigned long ulBound)
 
void __ubsan_handle_vla_bound_not_positive_abort (struct CVLABoundData *pData, unsigned long ulBound)
 
void __ubsan_get_current_report_data (const char **ppOutIssueKind, const char **ppOutMessage, const char **ppOutFilename, uint32_t *pOutLine, uint32_t *pOutCol, char **ppOutMemoryAddr)
 
static void HandleOverflow (bool isFatal, struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS, const char *szOperation)
 
static void HandleNegateOverflow (bool isFatal, struct COverflowData *pData, unsigned long ulOldValue)
 
static void HandleBuiltinUnreachable (bool isFatal, struct CUnreachableData *pData)
 
static void HandleTypeMismatch (bool isFatal, struct CSourceLocation *mLocation, struct CTypeDescriptor *mType, unsigned long mLogAlignment, uint8_t mTypeCheckKind, unsigned long ulPointer)
 
static void HandleVlaBoundNotPositive (bool isFatal, struct CVLABoundData *pData, unsigned long ulBound)
 
static void HandleOutOfBounds (bool isFatal, struct COutOfBoundsData *pData, unsigned long ulIndex)
 
static void HandleShiftOutOfBounds (bool isFatal, struct CShiftOutOfBoundsData *pData, unsigned long ulLHS, unsigned long ulRHS)
 
static void HandleLoadInvalidValue (bool isFatal, struct CInvalidValueData *pData, unsigned long ulValue)
 
static void HandleInvalidBuiltin (bool isFatal, struct CInvalidBuiltinData *pData)
 
static void HandleFunctionTypeMismatch (bool isFatal, struct CFunctionTypeMismatchData *pData, unsigned long ulFunction)
 
static void HandleCFIBadType (bool isFatal, struct CCFICheckFailData *pData, unsigned long ulVtable, bool *bValidVtable, bool *FromUnrecoverableHandler, unsigned long *ProgramCounter, unsigned long *FramePointer)
 
static void HandleDynamicTypeCacheMiss (bool isFatal, struct CDynamicTypeCacheMissData *pData, unsigned long ulPointer, unsigned long ulHash)
 
static void HandleFloatCastOverflow (bool isFatal, struct CFloatCastOverflowData *pData, unsigned long ulFrom)
 
static void HandleMissingReturn (bool isFatal, struct CUnreachableData *pData)
 
static void HandleNonnullArg (bool isFatal, struct CNonNullArgData *pData)
 
static void HandleNonnullReturn (bool isFatal, struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer)
 
static void HandlePointerOverflow (bool isFatal, struct CPointerOverflowData *pData, unsigned long ulBase, unsigned long ulResult)
 
static void HandleAlignmentAssumption (bool isFatal, struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset)
 

Variables

intptr_t __ubsan_vptr_type_cache [128]
 

Macro Definition Documentation

◆ __arraycount

#define __arraycount (   x)    nitems(x)

Definition at line 57 of file kern_ubsan.c.

◆ __BIT

#define __BIT (   x)    ((uintmax_t)1 << (uintmax_t)(x))

Definition at line 59 of file kern_ubsan.c.

◆ __LOWEST_SET_BIT

#define __LOWEST_SET_BIT (   __mask)    ((((__mask) - 1) & (__mask)) ^ (__mask))

Definition at line 60 of file kern_ubsan.c.

◆ __SHIFTOUT

#define __SHIFTOUT (   __x,
  __mask 
)    (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))

Definition at line 61 of file kern_ubsan.c.

◆ ACK_REPORTED

#define ACK_REPORTED   __BIT(31)

Definition at line 96 of file kern_ubsan.c.

◆ ASSERT

#define ASSERT (   x)    KASSERT(x, ("%s: " __STRING(x) " failed", __func__))

Definition at line 56 of file kern_ubsan.c.

◆ CFI_DERIVEDCAST

#define CFI_DERIVEDCAST   2

Definition at line 105 of file kern_ubsan.c.

◆ CFI_ICALL

#define CFI_ICALL   4

Definition at line 107 of file kern_ubsan.c.

◆ CFI_NVCALL

#define CFI_NVCALL   1

Definition at line 104 of file kern_ubsan.c.

◆ CFI_NVMFCALL

#define CFI_NVMFCALL   5

Definition at line 108 of file kern_ubsan.c.

◆ CFI_UNRELATEDCAST

#define CFI_UNRELATEDCAST   3

Definition at line 106 of file kern_ubsan.c.

◆ CFI_VCALL

#define CFI_VCALL   0

Definition at line 103 of file kern_ubsan.c.

◆ CFI_VMFCALL

#define CFI_VMFCALL   6

Definition at line 109 of file kern_ubsan.c.

◆ DIVREM_STRING

#define DIVREM_STRING   "divrem"

Definition at line 101 of file kern_ubsan.c.

◆ ISSET

#define ISSET (   x,
 
)    ((x) & (y))

Definition at line 58 of file kern_ubsan.c.

◆ KIND_FLOAT

#define KIND_FLOAT   1

Definition at line 143 of file kern_ubsan.c.

◆ KIND_INTEGER

#define KIND_INTEGER   0

Definition at line 142 of file kern_ubsan.c.

◆ KIND_UNKNOWN

#define KIND_UNKNOWN   UINT16_MAX

Definition at line 144 of file kern_ubsan.c.

◆ LOCATION_MAXLEN

#define LOCATION_MAXLEN   (PATH_MAX + 32 /* ':LINE:COLUMN' */)

Definition at line 112 of file kern_ubsan.c.

◆ MINUS_STRING

#define MINUS_STRING   "-"

Definition at line 100 of file kern_ubsan.c.

◆ MUL_STRING

#define MUL_STRING   "*"

Definition at line 98 of file kern_ubsan.c.

◆ NUMBER_MAXLEN

#define NUMBER_MAXLEN   128

Definition at line 111 of file kern_ubsan.c.

◆ NUMBER_SIGNED_BIT

#define NUMBER_SIGNED_BIT   1U

Definition at line 122 of file kern_ubsan.c.

◆ PLUS_STRING

#define PLUS_STRING   "+"

Definition at line 99 of file kern_ubsan.c.

◆ REINTERPRET_CAST

#define REINTERPRET_CAST (   __dt,
  __st 
)    ((__dt)(__st))

Definition at line 93 of file kern_ubsan.c.

◆ STATIC_CAST

#define STATIC_CAST (   __dt,
  __st 
)    ((__dt)(__st))

Definition at line 94 of file kern_ubsan.c.

◆ WIDTH_128

#define WIDTH_128   128

Definition at line 120 of file kern_ubsan.c.

◆ WIDTH_16

#define WIDTH_16   16

Definition at line 115 of file kern_ubsan.c.

◆ WIDTH_32

#define WIDTH_32   32

Definition at line 116 of file kern_ubsan.c.

◆ WIDTH_64

#define WIDTH_64   64

Definition at line 117 of file kern_ubsan.c.

◆ WIDTH_8

#define WIDTH_8   8

Definition at line 114 of file kern_ubsan.c.

◆ WIDTH_80

#define WIDTH_80   80

Definition at line 118 of file kern_ubsan.c.

◆ WIDTH_96

#define WIDTH_96   96

Definition at line 119 of file kern_ubsan.c.

Typedef Documentation

◆ longest

typedef int64_t longest

Definition at line 128 of file kern_ubsan.c.

◆ ulongest

typedef uint64_t ulongest

Definition at line 129 of file kern_ubsan.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ __ubsan_get_current_report_data()

void __ubsan_get_current_report_data ( const char **  ppOutIssueKind,
const char **  ppOutMessage,
const char **  ppOutFilename,
uint32_t *  pOutLine,
uint32_t *  pOutCol,
char **  ppOutMemoryAddr 
)

Definition at line 1158 of file kern_ubsan.c.

◆ __ubsan_handle_add_overflow()

void __ubsan_handle_add_overflow ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 731 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and PLUS_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_add_overflow_abort()

void __ubsan_handle_add_overflow_abort ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 740 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and PLUS_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_alignment_assumption()

void __ubsan_handle_alignment_assumption ( struct CAlignmentAssumptionData pData,
unsigned long  ulPointer,
unsigned long  ulAlignment,
unsigned long  ulOffset 
)

Definition at line 749 of file kern_ubsan.c.

References ASSERT, and HandleAlignmentAssumption().

Here is the call graph for this function:

◆ __ubsan_handle_alignment_assumption_abort()

void __ubsan_handle_alignment_assumption_abort ( struct CAlignmentAssumptionData pData,
unsigned long  ulPointer,
unsigned long  ulAlignment,
unsigned long  ulOffset 
)

Definition at line 758 of file kern_ubsan.c.

References ASSERT, and HandleAlignmentAssumption().

Here is the call graph for this function:

◆ __ubsan_handle_builtin_unreachable()

void __ubsan_handle_builtin_unreachable ( struct CUnreachableData pData)

Definition at line 767 of file kern_ubsan.c.

References ASSERT, and HandleBuiltinUnreachable().

Here is the call graph for this function:

◆ __ubsan_handle_cfi_bad_type()

void __ubsan_handle_cfi_bad_type ( struct CCFICheckFailData pData,
unsigned long  ulVtable,
bool  bValidVtable,
bool  FromUnrecoverableHandler,
unsigned long  ProgramCounter,
unsigned long  FramePointer 
)

Definition at line 776 of file kern_ubsan.c.

References ASSERT, and HandleCFIBadType().

Here is the call graph for this function:

◆ __ubsan_handle_cfi_check_fail()

void __ubsan_handle_cfi_check_fail ( struct CCFICheckFailData pData,
unsigned long  ulValue,
unsigned long  ulValidVtable 
)

Definition at line 785 of file kern_ubsan.c.

References ASSERT, and HandleCFIBadType().

Here is the call graph for this function:

◆ __ubsan_handle_cfi_check_fail_abort()

void __ubsan_handle_cfi_check_fail_abort ( struct CCFICheckFailData pData,
unsigned long  ulValue,
unsigned long  ulValidVtable 
)

Definition at line 794 of file kern_ubsan.c.

References ASSERT, and HandleCFIBadType().

Here is the call graph for this function:

◆ __ubsan_handle_divrem_overflow()

void __ubsan_handle_divrem_overflow ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 803 of file kern_ubsan.c.

References ASSERT, DIVREM_STRING, and HandleOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_divrem_overflow_abort()

void __ubsan_handle_divrem_overflow_abort ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 812 of file kern_ubsan.c.

References ASSERT, DIVREM_STRING, and HandleOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_dynamic_type_cache_miss()

void __ubsan_handle_dynamic_type_cache_miss ( struct CDynamicTypeCacheMissData pData,
unsigned long  ulPointer,
unsigned long  ulHash 
)

Definition at line 821 of file kern_ubsan.c.

References ASSERT, and HandleDynamicTypeCacheMiss().

Here is the call graph for this function:

◆ __ubsan_handle_dynamic_type_cache_miss_abort()

void __ubsan_handle_dynamic_type_cache_miss_abort ( struct CDynamicTypeCacheMissData pData,
unsigned long  ulPointer,
unsigned long  ulHash 
)

Definition at line 830 of file kern_ubsan.c.

References ASSERT, and HandleDynamicTypeCacheMiss().

Here is the call graph for this function:

◆ __ubsan_handle_float_cast_overflow()

void __ubsan_handle_float_cast_overflow ( struct CFloatCastOverflowData pData,
unsigned long  ulFrom 
)

Definition at line 839 of file kern_ubsan.c.

References ASSERT, and HandleFloatCastOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_float_cast_overflow_abort()

void __ubsan_handle_float_cast_overflow_abort ( struct CFloatCastOverflowData pData,
unsigned long  ulFrom 
)

Definition at line 848 of file kern_ubsan.c.

References ASSERT, and HandleFloatCastOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_function_type_mismatch()

void __ubsan_handle_function_type_mismatch ( struct CFunctionTypeMismatchData pData,
unsigned long  ulFunction 
)

Definition at line 857 of file kern_ubsan.c.

References ASSERT, and HandleFunctionTypeMismatch().

Here is the call graph for this function:

◆ __ubsan_handle_function_type_mismatch_abort()

void __ubsan_handle_function_type_mismatch_abort ( struct CFunctionTypeMismatchData pData,
unsigned long  ulFunction 
)

Definition at line 866 of file kern_ubsan.c.

References ASSERT, and HandleFunctionTypeMismatch().

Here is the call graph for this function:

◆ __ubsan_handle_invalid_builtin()

void __ubsan_handle_invalid_builtin ( struct CInvalidBuiltinData pData)

Definition at line 875 of file kern_ubsan.c.

References ASSERT, and HandleInvalidBuiltin().

Here is the call graph for this function:

◆ __ubsan_handle_invalid_builtin_abort()

void __ubsan_handle_invalid_builtin_abort ( struct CInvalidBuiltinData pData)

Definition at line 884 of file kern_ubsan.c.

References ASSERT, and HandleInvalidBuiltin().

Here is the call graph for this function:

◆ __ubsan_handle_load_invalid_value()

void __ubsan_handle_load_invalid_value ( struct CInvalidValueData pData,
unsigned long  ulVal 
)

Definition at line 893 of file kern_ubsan.c.

References ASSERT, and HandleLoadInvalidValue().

Here is the call graph for this function:

◆ __ubsan_handle_load_invalid_value_abort()

void __ubsan_handle_load_invalid_value_abort ( struct CInvalidValueData pData,
unsigned long  ulVal 
)

Definition at line 902 of file kern_ubsan.c.

References ASSERT, and HandleLoadInvalidValue().

Here is the call graph for this function:

◆ __ubsan_handle_missing_return()

void __ubsan_handle_missing_return ( struct CUnreachableData pData)

Definition at line 911 of file kern_ubsan.c.

References ASSERT, and HandleMissingReturn().

Here is the call graph for this function:

◆ __ubsan_handle_mul_overflow()

void __ubsan_handle_mul_overflow ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 920 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and MUL_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_mul_overflow_abort()

void __ubsan_handle_mul_overflow_abort ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 929 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and MUL_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_negate_overflow()

void __ubsan_handle_negate_overflow ( struct COverflowData pData,
unsigned long  ulOldVal 
)

Definition at line 938 of file kern_ubsan.c.

References ASSERT, and HandleNegateOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_negate_overflow_abort()

void __ubsan_handle_negate_overflow_abort ( struct COverflowData pData,
unsigned long  ulOldVal 
)

Definition at line 947 of file kern_ubsan.c.

References ASSERT, and HandleNegateOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_nonnull_arg()

void __ubsan_handle_nonnull_arg ( struct CNonNullArgData pData)

Definition at line 956 of file kern_ubsan.c.

References ASSERT, and HandleNonnullArg().

Here is the call graph for this function:

◆ __ubsan_handle_nonnull_arg_abort()

void __ubsan_handle_nonnull_arg_abort ( struct CNonNullArgData pData)

Definition at line 965 of file kern_ubsan.c.

References ASSERT, and HandleNonnullArg().

Here is the call graph for this function:

◆ __ubsan_handle_nonnull_return_v1()

void __ubsan_handle_nonnull_return_v1 ( struct CNonNullReturnData pData,
struct CSourceLocation pLocationPointer 
)

Definition at line 974 of file kern_ubsan.c.

References ASSERT, and HandleNonnullReturn().

Here is the call graph for this function:

◆ __ubsan_handle_nonnull_return_v1_abort()

void __ubsan_handle_nonnull_return_v1_abort ( struct CNonNullReturnData pData,
struct CSourceLocation pLocationPointer 
)

Definition at line 984 of file kern_ubsan.c.

References ASSERT, and HandleNonnullReturn().

Here is the call graph for this function:

◆ __ubsan_handle_nullability_arg()

void __ubsan_handle_nullability_arg ( struct CNonNullArgData pData)

Definition at line 994 of file kern_ubsan.c.

References ASSERT, and HandleNonnullArg().

Here is the call graph for this function:

◆ __ubsan_handle_nullability_arg_abort()

void __ubsan_handle_nullability_arg_abort ( struct CNonNullArgData pData)

Definition at line 1003 of file kern_ubsan.c.

References ASSERT, and HandleNonnullArg().

Here is the call graph for this function:

◆ __ubsan_handle_nullability_return_v1()

void __ubsan_handle_nullability_return_v1 ( struct CNonNullReturnData pData,
struct CSourceLocation pLocationPointer 
)

Definition at line 1012 of file kern_ubsan.c.

References ASSERT, and HandleNonnullReturn().

Here is the call graph for this function:

◆ __ubsan_handle_nullability_return_v1_abort()

void __ubsan_handle_nullability_return_v1_abort ( struct CNonNullReturnData pData,
struct CSourceLocation pLocationPointer 
)

Definition at line 1022 of file kern_ubsan.c.

References ASSERT, and HandleNonnullReturn().

Here is the call graph for this function:

◆ __ubsan_handle_out_of_bounds()

void __ubsan_handle_out_of_bounds ( struct COutOfBoundsData pData,
unsigned long  ulIndex 
)

Definition at line 1032 of file kern_ubsan.c.

References ASSERT, and HandleOutOfBounds().

Here is the call graph for this function:

◆ __ubsan_handle_out_of_bounds_abort()

void __ubsan_handle_out_of_bounds_abort ( struct COutOfBoundsData pData,
unsigned long  ulIndex 
)

Definition at line 1041 of file kern_ubsan.c.

References ASSERT, and HandleOutOfBounds().

Here is the call graph for this function:

◆ __ubsan_handle_pointer_overflow()

void __ubsan_handle_pointer_overflow ( struct CPointerOverflowData pData,
unsigned long  ulBase,
unsigned long  ulResult 
)

Definition at line 1050 of file kern_ubsan.c.

References ASSERT, and HandlePointerOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_pointer_overflow_abort()

void __ubsan_handle_pointer_overflow_abort ( struct CPointerOverflowData pData,
unsigned long  ulBase,
unsigned long  ulResult 
)

Definition at line 1059 of file kern_ubsan.c.

References ASSERT, and HandlePointerOverflow().

Here is the call graph for this function:

◆ __ubsan_handle_shift_out_of_bounds()

void __ubsan_handle_shift_out_of_bounds ( struct CShiftOutOfBoundsData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 1068 of file kern_ubsan.c.

References ASSERT, and HandleShiftOutOfBounds().

Here is the call graph for this function:

◆ __ubsan_handle_shift_out_of_bounds_abort()

void __ubsan_handle_shift_out_of_bounds_abort ( struct CShiftOutOfBoundsData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 1077 of file kern_ubsan.c.

References ASSERT, and HandleShiftOutOfBounds().

Here is the call graph for this function:

◆ __ubsan_handle_sub_overflow()

void __ubsan_handle_sub_overflow ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 1086 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and MINUS_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_sub_overflow_abort()

void __ubsan_handle_sub_overflow_abort ( struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)

Definition at line 1095 of file kern_ubsan.c.

References ASSERT, HandleOverflow(), and MINUS_STRING.

Here is the call graph for this function:

◆ __ubsan_handle_type_mismatch()

void __ubsan_handle_type_mismatch ( struct CTypeMismatchData pData,
unsigned long  ulPointer 
)

◆ __ubsan_handle_type_mismatch_abort()

void __ubsan_handle_type_mismatch_abort ( struct CTypeMismatchData pData,
unsigned long  ulPointer 
)

◆ __ubsan_handle_type_mismatch_v1()

void __ubsan_handle_type_mismatch_v1 ( struct CTypeMismatchData_v1 pData,
unsigned long  ulPointer 
)

◆ __ubsan_handle_type_mismatch_v1_abort()

void __ubsan_handle_type_mismatch_v1_abort ( struct CTypeMismatchData_v1 pData,
unsigned long  ulPointer 
)

◆ __ubsan_handle_vla_bound_not_positive()

void __ubsan_handle_vla_bound_not_positive ( struct CVLABoundData pData,
unsigned long  ulBound 
)

Definition at line 1140 of file kern_ubsan.c.

References ASSERT, and HandleVlaBoundNotPositive().

Here is the call graph for this function:

◆ __ubsan_handle_vla_bound_not_positive_abort()

void __ubsan_handle_vla_bound_not_positive_abort ( struct CVLABoundData pData,
unsigned long  ulBound 
)

Definition at line 1149 of file kern_ubsan.c.

References ASSERT, and HandleVlaBoundNotPositive().

Here is the call graph for this function:

◆ DeserializeBuiltinCheckKind()

static const char * DeserializeBuiltinCheckKind ( uint8_t  hhuBuiltinCheckKind)
static

Definition at line 1651 of file kern_ubsan.c.

References __arraycount, and ASSERT.

Referenced by HandleInvalidBuiltin().

Here is the caller graph for this function:

◆ DeserializeCFICheckKind()

static const char * DeserializeCFICheckKind ( uint8_t  hhuCFICheckKind)
static

Definition at line 1664 of file kern_ubsan.c.

References __arraycount, and ASSERT.

Referenced by HandleCFIBadType().

Here is the caller graph for this function:

◆ DeserializeLocation()

◆ DeserializeNumber()

static void DeserializeNumber ( char *  szLocation,
char *  pBuffer,
size_t  zBUfferLength,
struct CTypeDescriptor pType,
unsigned long  ulNumber 
)
static

◆ DeserializeNumberSigned()

static void DeserializeNumberSigned ( char *  pBuffer,
size_t  zBUfferLength,
struct CTypeDescriptor pType,
longest  L 
)
static

Definition at line 1348 of file kern_ubsan.c.

References ASSERT, ISSET, CTypeDescriptor::mTypeInfo, NUMBER_SIGNED_BIT, snprintf(), STATIC_CAST, WIDTH_128, WIDTH_16, WIDTH_32, WIDTH_64, WIDTH_8, and zDeserializeTypeWidth().

Referenced by DeserializeNumber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeNumberUnsigned()

static void DeserializeNumberUnsigned ( char *  pBuffer,
size_t  zBUfferLength,
struct CTypeDescriptor pType,
ulongest  L 
)
static

Definition at line 1375 of file kern_ubsan.c.

References ASSERT, ISSET, CTypeDescriptor::mTypeInfo, NUMBER_SIGNED_BIT, snprintf(), STATIC_CAST, WIDTH_128, WIDTH_16, WIDTH_32, WIDTH_64, WIDTH_8, and zDeserializeTypeWidth().

Referenced by DeserializeNumber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeTypeCheckKind()

static const char * DeserializeTypeCheckKind ( uint8_t  hhuTypeCheckKind)
static

Definition at line 1628 of file kern_ubsan.c.

References __arraycount, and ASSERT.

Referenced by HandleDynamicTypeCacheMiss(), and HandleTypeMismatch().

Here is the caller graph for this function:

◆ HandleAlignmentAssumption()

static void HandleAlignmentAssumption ( bool  isFatal,
struct CAlignmentAssumptionData pData,
unsigned long  ulPointer,
unsigned long  ulAlignment,
unsigned long  ulOffset 
)
static

◆ HandleBuiltinUnreachable()

static void HandleBuiltinUnreachable ( bool  isFatal,
struct CUnreachableData pData 
)
static

Definition at line 389 of file kern_ubsan.c.

References ASSERT, DeserializeLocation(), isAlreadyReported(), LOCATION_MAXLEN, CUnreachableData::mLocation, and Report().

Referenced by __ubsan_handle_builtin_unreachable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleCFIBadType()

static void HandleCFIBadType ( bool  isFatal,
struct CCFICheckFailData pData,
unsigned long  ulVtable,
bool *  bValidVtable,
bool *  FromUnrecoverableHandler,
unsigned long *  ProgramCounter,
unsigned long *  FramePointer 
)
static

◆ HandleDynamicTypeCacheMiss()

static void HandleDynamicTypeCacheMiss ( bool  isFatal,
struct CDynamicTypeCacheMissData pData,
unsigned long  ulPointer,
unsigned long  ulHash 
)
static

◆ HandleFloatCastOverflow()

static void HandleFloatCastOverflow ( bool  isFatal,
struct CFloatCastOverflowData pData,
unsigned long  ulFrom 
)
static

◆ HandleFunctionTypeMismatch()

static void HandleFunctionTypeMismatch ( bool  isFatal,
struct CFunctionTypeMismatchData pData,
unsigned long  ulFunction 
)
static

◆ HandleInvalidBuiltin()

static void HandleInvalidBuiltin ( bool  isFatal,
struct CInvalidBuiltinData pData 
)
static

Definition at line 514 of file kern_ubsan.c.

References ASSERT, DeserializeBuiltinCheckKind(), DeserializeLocation(), isAlreadyReported(), LOCATION_MAXLEN, CInvalidBuiltinData::mKind, CInvalidBuiltinData::mLocation, and Report().

Referenced by __ubsan_handle_invalid_builtin(), and __ubsan_handle_invalid_builtin_abort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleLoadInvalidValue()

static void HandleLoadInvalidValue ( bool  isFatal,
struct CInvalidValueData pData,
unsigned long  ulValue 
)
static

◆ HandleMissingReturn()

static void HandleMissingReturn ( bool  isFatal,
struct CUnreachableData pData 
)
static

Definition at line 627 of file kern_ubsan.c.

References ASSERT, DeserializeLocation(), isAlreadyReported(), LOCATION_MAXLEN, CUnreachableData::mLocation, and Report().

Referenced by __ubsan_handle_missing_return().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleNegateOverflow()

static void HandleNegateOverflow ( bool  isFatal,
struct COverflowData pData,
unsigned long  ulOldValue 
)
static

Definition at line 371 of file kern_ubsan.c.

References ASSERT, DeserializeLocation(), DeserializeNumber(), isAlreadyReported(), LOCATION_MAXLEN, COverflowData::mLocation, COverflowData::mType, CTypeDescriptor::mTypeName, NUMBER_MAXLEN, and Report().

Referenced by __ubsan_handle_negate_overflow(), and __ubsan_handle_negate_overflow_abort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleNonnullArg()

static void HandleNonnullArg ( bool  isFatal,
struct CNonNullArgData pData 
)
static

◆ HandleNonnullReturn()

static void HandleNonnullReturn ( bool  isFatal,
struct CNonNullReturnData pData,
struct CSourceLocation pLocationPointer 
)
static

◆ HandleOutOfBounds()

static void HandleOutOfBounds ( bool  isFatal,
struct COutOfBoundsData pData,
unsigned long  ulIndex 
)
static

◆ HandleOverflow()

static void HandleOverflow ( bool  isFatal,
struct COverflowData pData,
unsigned long  ulLHS,
unsigned long  ulRHS,
const char *  szOperation 
)
static

◆ HandlePointerOverflow()

static void HandlePointerOverflow ( bool  isFatal,
struct CPointerOverflowData pData,
unsigned long  ulBase,
unsigned long  ulResult 
)
static

Definition at line 686 of file kern_ubsan.c.

References ASSERT, DeserializeLocation(), isAlreadyReported(), LOCATION_MAXLEN, CPointerOverflowData::mLocation, and Report().

Referenced by __ubsan_handle_pointer_overflow(), and __ubsan_handle_pointer_overflow_abort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleShiftOutOfBounds()

static void HandleShiftOutOfBounds ( bool  isFatal,
struct CShiftOutOfBoundsData pData,
unsigned long  ulLHS,
unsigned long  ulRHS 
)
static

◆ HandleTypeMismatch()

static void HandleTypeMismatch ( bool  isFatal,
struct CSourceLocation mLocation,
struct CTypeDescriptor mType,
unsigned long  mLogAlignment,
uint8_t  mTypeCheckKind,
unsigned long  ulPointer 
)
static

◆ HandleVlaBoundNotPositive()

static void HandleVlaBoundNotPositive ( bool  isFatal,
struct CVLABoundData pData,
unsigned long  ulBound 
)
static

Definition at line 430 of file kern_ubsan.c.

References ASSERT, DeserializeLocation(), DeserializeNumber(), isAlreadyReported(), LOCATION_MAXLEN, CVLABoundData::mLocation, CVLABoundData::mType, NUMBER_MAXLEN, and Report().

Referenced by __ubsan_handle_vla_bound_not_positive(), and __ubsan_handle_vla_bound_not_positive_abort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAlreadyReported()

◆ isNegativeNumber()

static bool isNegativeNumber ( char *  szLocation,
struct CTypeDescriptor pType,
unsigned long  ulNumber 
)
static

Definition at line 1682 of file kern_ubsan.c.

References ASSERT, ISSET, KIND_INTEGER, llliGetNumber(), CTypeDescriptor::mTypeInfo, CTypeDescriptor::mTypeKind, and NUMBER_SIGNED_BIT.

Referenced by HandleShiftOutOfBounds().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isShiftExponentTooLarge()

static bool isShiftExponentTooLarge ( char *  szLocation,
struct CTypeDescriptor pType,
unsigned long  ulNumber,
size_t  zWidth 
)
static

Definition at line 1696 of file kern_ubsan.c.

References ASSERT, KIND_INTEGER, llluGetNumber(), and CTypeDescriptor::mTypeKind.

Referenced by HandleShiftOutOfBounds().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ llliGetNumber()

static longest llliGetNumber ( char *  szLocation,
struct CTypeDescriptor pType,
unsigned long  ulNumber 
)
static

Definition at line 1475 of file kern_ubsan.c.

References ASSERT, REINTERPRET_CAST, Report(), STATIC_CAST, WIDTH_128, WIDTH_16, WIDTH_32, WIDTH_64, WIDTH_8, and zDeserializeTypeWidth().

Referenced by DeserializeNumber(), and isNegativeNumber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ llluGetNumber()

static ulongest llluGetNumber ( char *  szLocation,
struct CTypeDescriptor pType,
unsigned long  ulNumber 
)
static

Definition at line 1518 of file kern_ubsan.c.

References ASSERT, REINTERPRET_CAST, Report(), WIDTH_128, WIDTH_16, WIDTH_32, WIDTH_64, WIDTH_8, and zDeserializeTypeWidth().

Referenced by DeserializeNumber(), and isShiftExponentTooLarge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Report()

◆ zDeserializeTypeWidth()

static size_t zDeserializeTypeWidth ( struct CTypeDescriptor pType)
static

Definition at line 1290 of file kern_ubsan.c.

References __BIT, __SHIFTOUT, ASSERT, KIND_FLOAT, KIND_INTEGER, CTypeDescriptor::mTypeInfo, CTypeDescriptor::mTypeKind, NUMBER_SIGNED_BIT, and Report().

Referenced by DeserializeNumberSigned(), DeserializeNumberUnsigned(), HandleShiftOutOfBounds(), llliGetNumber(), and llluGetNumber().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __ubsan_vptr_type_cache

intptr_t __ubsan_vptr_type_cache[128]

Definition at line 279 of file kern_ubsan.c.