diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-20 20:51:50 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-20 21:03:32 +0100 |
commit | 842716a0b5eceb8db31416cd643720c1037032b2 (patch) | |
tree | bcb0407e09c50a603ecf46c193ebd21a1230d423 /Kernel/StdLib.cpp | |
parent | f006e66a259e509dd91b97bca206e1e71d95e3af (diff) | |
download | serenity-842716a0b5eceb8db31416cd643720c1037032b2.zip |
Kernel+LibC: Build with basic -fstack-protector support
Use simple stack cookies to try to provoke an assertion failure on
stack overflow.
This is far from perfect, since we use a constant cookie instead of
generating a random one on startup, but it can still help us catch
bugs, which is the primary concern right now. :^)
Diffstat (limited to 'Kernel/StdLib.cpp')
-rw-r--r-- | Kernel/StdLib.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index a0b033cd71..6c4bcf8a63 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(); +} } |