mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 18:05:06 +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:
parent
f006e66a25
commit
842716a0b5
3 changed files with 18 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue