Kernel: Implement two missing ubsan handlers needed by lai

This commit is contained in:
Bananymous 2023-12-14 10:53:36 +02:00
parent 3f3e81fcf2
commit 0f1c740fe8
1 changed files with 22 additions and 0 deletions

View File

@ -57,6 +57,24 @@ extern "C"
const type_descriptor& type;
};
struct vla_bound_data
{
source_location location;
const type_descriptor& type;
};
enum builtin_check_kind : unsigned char
{
BCK_CTZPassedZero,
BCK_CLZPassedZero,
};
struct invalid_builtin_data
{
source_location location;
builtin_check_kind kind;
};
using value_handle = uintptr_t;
static const char* type_check_kinds[] = {
@ -92,6 +110,10 @@ extern "C"
HANDLER(__ubsan_handle_divrem_overflow, false, overflow_data* data, value_handle, value_handle)
HANDLER(__ubsan_handle_negate_overflow, false, overflow_data* data, value_handle)
HANDLER(__ubsan_handle_vla_bound_not_positive, false, vla_bound_data* data, value_handle);
HANDLER(__ubsan_handle_invalid_builtin, false, invalid_builtin_data* data);
void __ubsan_handle_type_mismatch_v1(type_mismatch_data* data, value_handle pointer)
{
print_location(data->location);