1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

Kernel: Implement some more KUBSAN checks :^)

This patch enables the following -fsanitize sub-options:

* bounds
* bounds-strict
* integer-divide-by-zero
* return
* shift
* shift-base
* shift-exponent
This commit is contained in:
Andreas Kling 2021-02-06 16:08:30 +01:00
parent 547130584c
commit fad0332898
3 changed files with 34 additions and 1 deletions

View file

@ -87,4 +87,25 @@ void __ubsan_handle_mul_overflow(const OverflowData& data, void*, void*)
dbgln("KUBSAN: multiplication overflow, {} ({}-bit)", data.type.name(), data.type.bit_width());
print_location(data.location);
}
void __ubsan_handle_shift_out_of_bounds(const ShiftOutOfBoundsData&, void* lhs, void* rhs);
void __ubsan_handle_shift_out_of_bounds(const ShiftOutOfBoundsData& data, void*, void*)
{
dbgln("KUBSAN: shift out of bounds, {} ({}-bit) shifted by {} ({}-bit)", data.lhs_type.name(), data.lhs_type.bit_width(), data.rhs_type.name(), data.rhs_type.bit_width());
print_location(data.location);
}
void __ubsan_handle_divrem_overflow(const OverflowData&, void* lhs, void* rhs);
void __ubsan_handle_divrem_overflow(const OverflowData& data, void*, void*)
{
dbgln("KUBSAN: divrem overlow, {} ({}-bit)", data.type.name(), data.type.bit_width());
print_location(data.location);
}
void __ubsan_handle_out_of_bounds(const OutOfBoundsData&, void*);
void __ubsan_handle_out_of_bounds(const OutOfBoundsData& data, void*)
{
dbgln("KUBSAN: out of bounds access into array of {} ({}-bit), index type {} ({}-bit)", data.array_type.name(), data.array_type.bit_width(), data.index_type.name(), data.index_type.bit_width());
print_location(data.location);
}
}