Changeset a4cf312 in mainline for uspace/lib/c/generic/ubsan.c
- Timestamp:
- 2019-06-05T13:58:08Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 58168e0
- Parents:
- a18da67
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ubsan.c
ra18da67 ra4cf312 35 35 }; 36 36 37 struct type_mismatch_data_v1 { 38 struct source_location loc; 39 struct type_descriptor *type; 40 unsigned char log_alignment; 41 unsigned char type_check_kind; 42 }; 43 37 44 struct overflow_data { 38 45 struct source_location loc; … … 73 80 struct source_location loc; 74 81 struct source_location attr_loc; 82 }; 83 84 struct pointer_overflow_data { 85 struct source_location loc; 75 86 }; 76 87 … … 81 92 */ 82 93 void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, unsigned long ptr); 94 void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, unsigned long ptr); 83 95 void __ubsan_handle_add_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs); 84 96 void __ubsan_handle_sub_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs); … … 99 111 void __ubsan_handle_nonnull_return(struct nonnull_return_data *data); 100 112 void __ubsan_handle_builtin_unreachable(struct unreachable_data *data); 113 void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data, 114 unsigned long base, unsigned long result); 101 115 102 116 static void print_loc(const char *func, struct source_location *loc) … … 121 135 } 122 136 137 void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, 138 unsigned long ptr) 139 { 140 print_loc(__func__, &data->loc); 141 PRINTF("Type: %s, alignment: %hhu, type_check_kind: %hhu\n", 142 data->type->type_name, data->log_alignment, data->type_check_kind); 143 ubsan_panic(); 144 } 145 123 146 void __ubsan_handle_add_overflow(struct overflow_data *data, 124 147 unsigned long lhs, … … 228 251 ubsan_panic(); 229 252 } 253 254 void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data, 255 unsigned long base, unsigned long result) 256 { 257 print_loc(__func__, &data->loc); 258 ubsan_panic(); 259 }
Note:
See TracChangeset
for help on using the changeset viewer.