From 89259ec9b23d830d1eabb59bf2629a7032f16e55 Mon Sep 17 00:00:00 2001 From: xamidev Date: Thu, 26 Mar 2026 20:14:56 +0100 Subject: [PATCH] Stack Smashing Protection --- Makefile | 2 +- include/config.h | 3 +++ src/kapps/kshell.c | 17 ++++++++++++++++- src/kmain.c | 9 +++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b2499c8..7e20f9c 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SOURCES := $(shell find src -name '*.c') OBJFILES := $(patsubst $(SRC)/%.c, $(BUILDDIR)/%.o, $(SOURCES)) CC := x86_64-elf-gcc -CC_FLAGS=-Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel +CC_FLAGS=-Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fstack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel CC_PROBLEMATIC_FLAGS=-Wno-unused-parameter -Wno-unused-variable LD := x86_64-elf-ld diff --git a/include/config.h b/include/config.h index f557563..2ec0d50 100644 --- a/include/config.h +++ b/include/config.h @@ -55,4 +55,7 @@ /* time */ #define TIMER_FREQUENCY 1000 +/* ssp */ +#define STACK_CHK_GUARD 0x7ABA5C007ABA5C00 + #endif diff --git a/src/kapps/kshell.c b/src/kapps/kshell.c index eaef7ed..ae30832 100644 --- a/src/kapps/kshell.c +++ b/src/kapps/kshell.c @@ -12,6 +12,15 @@ #include #include