From c197383a7431dcec15a8369cb55a24876f15ad7f Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Thu, 14 Mar 2024 04:44:19 +0200 Subject: [PATCH] Update page table in __stack_chk_fail and __chk_fail functions --- core/stack_check.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/stack_check.cpp b/core/stack_check.cpp index 030d940..7d3c4eb 100644 --- a/core/stack_check.cpp +++ b/core/stack_check.cpp @@ -57,6 +57,8 @@ EXTERNC __constructor __no_stack_protector void __guard_setup(void) EXTERNC __noreturn __no_stack_protector void __stack_chk_fail(void) { + CPU::PageTable(KernelPageTable); + void *Stack = nullptr; #if defined(a64) asmv("movq %%rsp, %0" @@ -76,5 +78,7 @@ EXTERNC __noreturn __no_stack_protector void __stack_chk_fail(void) // https://github.com/gcc-mirror/gcc/blob/master/libssp/ssp.c EXTERNC __noreturn nsa void __chk_fail(void) { + CPU::PageTable(KernelPageTable); + HandleBufferOverflow(); }