diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index a0b033cd71e..6c4bcf8a638 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -183,4 +183,12 @@ void free(void* p) { return kfree(p); } + +extern u32 __stack_chk_guard; +u32 __stack_chk_guard = (u32)0xc0000c13; + +[[noreturn]] void __stack_chk_fail() +{ + ASSERT_NOT_REACHED(); +} } diff --git a/Libraries/LibC/crt0.cpp b/Libraries/LibC/crt0.cpp index 8466abefdf3..d8f6da41efb 100644 --- a/Libraries/LibC/crt0.cpp +++ b/Libraries/LibC/crt0.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -51,4 +52,12 @@ int _start(int argc, char** argv, char** env) void __cxa_atexit() { } + +extern u32 __stack_chk_guard; +u32 __stack_chk_guard = (u32)0xc0000c13; + +[[noreturn]] void __stack_chk_fail() +{ + ASSERT_NOT_REACHED(); +} } diff --git a/Makefile.common b/Makefile.common index 4b0c4e7a518..b02681564ab 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,7 +1,7 @@ ARCH_FLAGS = STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation -fno-sized-deallocation WARNING_FLAGS = -Werror -Wextra -Wall -Wno-nonnull-compare -Wno-deprecated-copy -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-expansion-to-defined -FLAVOR_FLAGS = -fno-exceptions -fno-rtti +FLAVOR_FLAGS = -fno-exceptions -fno-rtti -fstack-protector OPTIMIZATION_FLAGS = -Os MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))