Skip to content

Commit

Permalink
ubsan: add handle_builtin_unreachable
Browse files Browse the repository at this point in the history
  • Loading branch information
moodyhunter committed Aug 15, 2024
1 parent b60d8c4 commit 6694b15
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kernel/misc/ubsan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

0 comments on commit 6694b15

Please sign in to comment.