Stack Smashing Protection

This commit is contained in:
2026-03-26 20:14:56 +01:00
parent 0fbaf6d26e
commit 89259ec9b2
4 changed files with 29 additions and 2 deletions
+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);
}
}