fix: ssp is now enabled and it no longer crashes with several prints (so far)

This commit is contained in:
0x35c 2024-11-16 14:56:05 +01:00
parent 20ba985b34
commit d8d31d959f
4 changed files with 18 additions and 3 deletions

View File

@ -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)

View File

@ -1,3 +1,3 @@
#pragma once
void kpanic(const char *format, ...);
__attribute__((noreturn)) void kpanic(const char *format, ...);

View File

@ -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;
}

12
src/ssp.c Normal file
View File

@ -0,0 +1,12 @@
#include "kpanic.h"
#include <stdint.h>
#define STACK_CHK_GUARD 0xe2dee396
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
__attribute__((noreturn)) void __stack_chk_fail(void)
{
kpanic("Stack smashing detected");
}