From 60d52576784afef107ca01a89fc4499dd1101511 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 22 Sep 2024 17:14:36 +0300 Subject: [PATCH] Kenrel: Add __builtin_unreachable support for UBSAN --- kernel/ubsan.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/ubsan.cpp b/kernel/ubsan.cpp index 6b737d31a6..8ee064d470 100644 --- a/kernel/ubsan.cpp +++ b/kernel/ubsan.cpp @@ -75,6 +75,11 @@ extern "C" builtin_check_kind kind; }; + struct unreachable_data + { + struct source_location location; + }; + using value_handle = uintptr_t; static const char* type_check_kinds[] = { @@ -114,6 +119,8 @@ extern "C" HANDLER(__ubsan_handle_invalid_builtin, false, invalid_builtin_data* data); + HANDLER(__ubsan_handle_builtin_unreachable, true, unreachable_data* data); + void __ubsan_handle_type_mismatch_v1(type_mismatch_data* data, value_handle pointer) { print_location(data->location);