From 85e0c445aeae4893599c7ab19c755c25ea7a0f52 Mon Sep 17 00:00:00 2001 From: flysand7 Date: Sun, 23 Jul 2023 18:28:04 +1100 Subject: [PATCH] Implement __stack_chk_fail --- src/linux/entry.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/linux/entry.c b/src/linux/entry.c index bc7b0f9..3d28731 100644 --- a/src/linux/entry.c +++ b/src/linux/entry.c @@ -1,8 +1,13 @@ -int __stack_chk_fail() { - // TODO: implement proper stack protector support - return 0; +static char stack_chk_fail_msg[] = + "Stack check failed. " + "You've got a stack corruption somewhere. " + "Sorry these guys didn't tell me where\n"; + +void __stack_chk_fail(void) { + syscall_write(STDERR_FILENO, stack_chk_fail_msg, sizeof stack_chk_fail_msg); + syscall_exit(1); } void __libc_start_main(