Stop on asan errors

This commit is contained in:
2024-03-23 10:47:49 +01:00
parent 11b18a2073
commit ccd5678d5a

View File

@@ -102,6 +102,8 @@ struct type_mismatch_info {
uint8_t type_check_kind;
};
#define SAN_STOP true
#define is_aligned(value, alignment) !(value & (alignment - 1))
[[maybe_unused]] void __ubsan_handle_type_mismatch_v1(struct type_mismatch_info *type_mismatch,
uintptr_t pointer) {
@@ -113,42 +115,51 @@ struct type_mismatch_info {
// Most useful on architectures with stricter memory alignment requirements, like ARM.
writestr_no_yield("Warning: unaligned memory access \n");
} else {
writestr_no_yield("Warning: insufficient size ");
writestr_no_yield("Warning: insufficient size \n");
}
// log_location(location);
// writestr_no_yield(" \n");
// _hcf();
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_pointer_overflow() {
writestr_no_yield("Warning: pointer overflow\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_load_invalid_value() {
writestr_no_yield("Warning: invalid value load\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_out_of_bounds() {
writestr_no_yield("Warning: out of bounds\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_add_overflow() {
writestr_no_yield("Warning: add overflow\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_missing_return() {
writestr_no_yield("Warning: missing return\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_sub_overflow() {
writestr_no_yield("Warning: sub overflow\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_shift_out_of_bounds() {
writestr_no_yield("Warning: shift overflow\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_builtin_unreachable() {
writestr_no_yield("Warning: unreachable\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_mul_overflow() {
writestr_no_yield("Warning: multiplication overflow\n");
if (SAN_STOP) _hcf();
}
[[maybe_unused]] void __ubsan_handle_divrem_overflow() {
writestr_no_yield("Warning: division overflow\n");
if (SAN_STOP) _hcf();
}
};