From 6694b1522e324129cdee059ce861174227077a62 Mon Sep 17 00:00:00 2001 From: Moody Liu Date: Thu, 15 Aug 2024 18:33:53 +0100 Subject: [PATCH] ubsan: add handle_builtin_unreachable --- kernel/misc/ubsan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/misc/ubsan.c b/kernel/misc/ubsan.c index 35c0300c..27be6d0f 100644 --- a/kernel/misc/ubsan.c +++ b/kernel/misc/ubsan.c @@ -37,6 +37,11 @@ struct out_of_bounds_info // struct type_descriptor right_type; }; +struct unreachable_data +{ + struct source_location location; +}; + static void log_location(struct source_location *location) { pr_emerg(" in file %s:%u, column %u", location->file, location->line, location->column); @@ -138,3 +143,9 @@ void __ubsan_handle_vla_bound_not_positive(struct source_location *location, str pr_emerg("VLA bound not positive, bound=%p of type %s", (void *) bound, type->name); log_location(location); } + +void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) +{ + pr_emerg("builtin unreachable was reached"); + log_location(&data->location); +}