diff options
author | Marvin Borner | 2021-03-14 16:12:44 +0100 |
---|---|---|
committer | GitHub | 2021-03-14 16:12:44 +0100 |
commit | 268f3ccdb90ab4b9bd70ca176478797aae97ca05 (patch) | |
tree | 2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /libc/sanitize.c | |
parent | 4309322f9d2b3e31421a3cc5399ab1f4368e0652 (diff) | |
parent | 6dec7db5158447b66f31a3f786ce2916cab83cec (diff) |
Added memory management using paging
This was quite a roller-coaster and most things are slower now, but it works and is way more secure. I still need to implement things like shared memory for the WM/GUI system but other than that everything is supported.
Diffstat (limited to 'libc/sanitize.c')
-rw-r--r-- | libc/sanitize.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/libc/sanitize.c b/libc/sanitize.c index 983b10f..8514e49 100644 --- a/libc/sanitize.c +++ b/libc/sanitize.c @@ -13,13 +13,13 @@ u32 __stack_chk_guard = STACK_CHK_GUARD; void __stack_chk_fail(void); -void __stack_chk_fail(void) +NORETURN void __stack_chk_fail(void) { panic("FATAL: Stack smashing detected\n"); } void __stack_chk_fail_local(void); -void __stack_chk_fail_local(void) +NORETURN void __stack_chk_fail_local(void) { panic("FATAL: Local stack smashing detected\n"); } @@ -97,28 +97,40 @@ void __ubsan_handle_vla_bound_not_positive(void) panic("UBSAN: vla-bound-not-positive\n"); } -void __ubsan_handle_add_overflow(void); -void __ubsan_handle_add_overflow(void) +void __ubsan_handle_add_overflow(struct overflow *data, void *left, void *right); +void __ubsan_handle_add_overflow(struct overflow *data, void *left, void *right) { - panic("UBSAN: add-overflow\n"); + UNUSED(left); + UNUSED(right); + struct source_location *loc = &data->location; + panic("%s:%d: UBSAN: add-overflow [type: %s]\n", loc->file, loc->line, data->type->name); } -void __ubsan_handle_sub_overflow(void); -void __ubsan_handle_sub_overflow(void) +void __ubsan_handle_sub_overflow(struct overflow *data, void *left, void *right); +void __ubsan_handle_sub_overflow(struct overflow *data, void *left, void *right) { - panic("UBSAN: sub-overflow\n"); + UNUSED(left); + UNUSED(right); + struct source_location *loc = &data->location; + panic("%s:%d: UBSAN: sub-overflow [type: %s]\n", loc->file, loc->line, data->type->name); } -void __ubsan_handle_negate_overflow(void); -void __ubsan_handle_negate_overflow(void) +void __ubsan_handle_negate_overflow(struct overflow *data, void *left, void *right); +void __ubsan_handle_negate_overflow(struct overflow *data, void *left, void *right) { - panic("UBSAN: negate-overflow\n"); + UNUSED(left); + UNUSED(right); + struct source_location *loc = &data->location; + panic("%s:%d: UBSAN: negate-overflow [type: %s]\n", loc->file, loc->line, data->type->name); } -void __ubsan_handle_mul_overflow(void); -void __ubsan_handle_mul_overflow(void) +void __ubsan_handle_mul_overflow(struct overflow *data, void *left, void *right); +void __ubsan_handle_mul_overflow(struct overflow *data, void *left, void *right) { - panic("UBSAN: mul-overflow\n"); + UNUSED(left); + UNUSED(right); + struct source_location *loc = &data->location; + panic("%s:%d: UBSAN: mul-overflow [type: %s]\n", loc->file, loc->line, data->type->name); } void __ubsan_handle_shift_out_of_bounds(void); |