syscall #17

Merged
xamidev merged 17 commits from syscall into main 2026-04-02 19:16:35 +02:00
4 changed files with 29 additions and 2 deletions
Showing only changes of commit 89259ec9b2 - Show all commits
+1 -1
View File
@@ -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
+3
View File
@@ -55,4 +55,7 @@
/* time */
#define TIMER_FREQUENCY 1000
/* ssp */
#define STACK_CHK_GUARD 0x7ABA5C007ABA5C00
#endif
+16 -1
View File
@@ -12,6 +12,15 @@
#include <kernel.h>
#include <time/date.h>
__attribute__((noinline))
void smash_it()
{
char buf[16]; (void)buf;
for (size_t i=0; i<256; i++) {
buf[i] = (char)i;
}
}
/*
* pedicel_main - Kernel shell main function
* @arg: argument (optional)
@@ -38,7 +47,8 @@ void pedicel_main(void* arg)
"panic - trigger a test panic\r\n"
"syscall - trigger int 0x80\r\n"
"pf - trigger a page fault\r\n"
"now - get current date\r\n");
"now - get current date\r\n"
"smash - smash the stack\r\n");
continue;
}
@@ -64,6 +74,11 @@ void pedicel_main(void* arg)
continue;
}
if (strncmp(input_buf, "smash", 5) == 0) {
smash_it();
continue;
}
printf("%s: command not found\r\n", input_buf);
}
}
+9
View File
@@ -85,6 +85,15 @@ void thing_main(void* arg)
extern uintptr_t kheap_start;
/* Stack Smashing Protection */
uint64_t __stack_chk_guard = STACK_CHK_GUARD;
void __stack_chk_fail(void)
{
panic(NULL, "SSP: Stask Smashing Detected!!! (very spicy)");
}
/*
* kmain - Kernel entry point
*