From 3f2cc6e3fff18bcce5fe7dd3285c31a463eebc41 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 17 Nov 2022 04:20:23 +0200 Subject: [PATCH] Updated ubsan --- Core/UndefinedBehaviorSanitization.c | 20 +++++++++++++++++++- Core/ubsan.h | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Core/UndefinedBehaviorSanitization.c b/Core/UndefinedBehaviorSanitization.c index 420da09..47c2fc5 100644 --- a/Core/UndefinedBehaviorSanitization.c +++ b/Core/UndefinedBehaviorSanitization.c @@ -92,7 +92,13 @@ extern void __asan_unregister_globals(void) { ubsan("unregister_globals"); } extern void __asan_init(void) { ubsan("init"); } extern void __asan_version_mismatch_check_v8(void) { ubsan("version_mismatch_check_v8"); } extern void __asan_option_detect_stack_use_after_return(void) { ubsan("stack use after return"); } -extern __noreturn void __asan_handle_no_return(void) { ubsan("no_return"); } + +extern __noreturn void __asan_handle_no_return(void) +{ + ubsan("no_return"); + while (1) + ; +} #define is_aligned(value, alignment) !(value & (alignment - 1)) @@ -249,3 +255,15 @@ void __ubsan_handle_missing_return(struct unreachable_data *data) if (UBSANMsg(data->location.file, data->location.line, data->location.column)) ubsan("Missing return."); } + +void __ubsan_vptr_type_cache(uintptr_t *cache, uintptr_t ptr) +{ + ubsan("Vptr type cache."); + *cache = ptr; +} + +void __ubsan_handle_dynamic_type_cache_miss(struct dynamic_type_cache_miss_data *data, uintptr_t ptr) +{ + if (UBSANMsg(data->location.file, data->location.line, data->location.column)) + ubsan("Dynamic type cache miss."); +} \ No newline at end of file diff --git a/Core/ubsan.h b/Core/ubsan.h index 0158207..9f0fc7c 100644 --- a/Core/ubsan.h +++ b/Core/ubsan.h @@ -85,4 +85,10 @@ struct shift_out_of_bounds_data struct type_descriptor *right_type; }; +struct dynamic_type_cache_miss_data +{ + struct source_location location; + struct type_descriptor *type; +}; + #endif // !__FENNIX_KERNEL_UBSAN_H__