diff --git a/Makefile b/Makefile index cd2c6e3..cd9412f 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NAME := bozOS AS := i386-elf-as ASFLAGS := CC := i386-elf-gcc -CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -g +CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g LD := $(CC) LDFLAGS := -T boot/linker.ld -ffreestanding -nostdlib LIBS := -L libbozo/build/ -lbozo -lgcc @@ -55,7 +55,9 @@ fclean: clean make -C libbozo fclean rm -rf build -re: fclean all +re: + $(MAKE) fclean + $(MAKE) all .PHONY: all clean fclean re run iso run-iso -include $(DEP) diff --git a/headers/kpanic.h b/headers/kpanic.h index 8fbca94..b40aff3 100644 --- a/headers/kpanic.h +++ b/headers/kpanic.h @@ -1,3 +1,3 @@ #pragma once -void kpanic(const char *format, ...); +__attribute__((noreturn)) void kpanic(const char *format, ...); diff --git a/src/memory/frame.c b/src/memory/frame.c index 98a85fc..d9ce363 100644 --- a/src/memory/frame.c +++ b/src/memory/frame.c @@ -18,6 +18,7 @@ void *alloc_frames(size_t size) kprintf("type: %d, addr: %p, len: %u, size: %u, \n", mmmt->type, mmmt->addr, mmmt->len, mmmt->size); } + PRINT_PTR(mmmt); } return NULL; } diff --git a/src/ssp.c b/src/ssp.c new file mode 100644 index 0000000..2b3b013 --- /dev/null +++ b/src/ssp.c @@ -0,0 +1,12 @@ +#include "kpanic.h" + +#include + +#define STACK_CHK_GUARD 0xe2dee396 + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) void __stack_chk_fail(void) +{ + kpanic("Stack smashing detected"); +}