From 666991265f368e19244d1088ee8c2c76edf76d86 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 18 Nov 2022 04:22:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=98noreturn=E2=80=99=20function=20does=20?= =?UTF-8?q?return?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/StackGuard.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Core/StackGuard.c b/Core/StackGuard.c index f25db44..a3cbb4b 100644 --- a/Core/StackGuard.c +++ b/Core/StackGuard.c @@ -38,10 +38,8 @@ __attribute__((weak, noreturn, no_stack_protector)) void __stack_chk_fail(void) error("Stack smashing detected!"); KPrint("\eFF0000Stack smashing detected!"); #if defined(__amd64__) || defined(__i386__) - asmv("loop__stack_chk_fail:\n" - "cli\n" - "hlt\n" - "jmp loop__stack_chk_fail\n"); + while (1) + asmv("cli; hlt"); #elif defined(__aarch64__) asmv("wfe"); #endif @@ -53,15 +51,10 @@ __attribute__((weak, noreturn, no_stack_protector)) void __chk_fail(void) TaskingPanic(); error("Buffer overflow detected!"); KPrint("\eFF0000Buffer overflow detected!"); - for (;;) - { #if defined(__amd64__) || defined(__i386__) - asmv("loop__chk_fail:\n" - "cli\n" - "hlt\n" - "jmp loop__chk_fail\n"); + while (1) + asmv("cli; hlt"); #elif defined(__aarch64__) - asmv("wfe"); + asmv("wfe"); #endif - } }