1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2019-12-20 20:51:50 +01:00
parent f006e66a25
commit 842716a0b5
3 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,4 @@
#include <AK/Types.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@ -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();
}
}