mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-31 08:47:57 +00:00
Stop tasking when stack guard fails
This commit is contained in:
parent
a9a5b1f64c
commit
13f93b8e21
@ -34,6 +34,7 @@ static void __attribute__((constructor, no_stack_protector)) __construct_stk_chk
|
|||||||
|
|
||||||
__attribute__((weak, noreturn, no_stack_protector)) void __stack_chk_fail(void)
|
__attribute__((weak, noreturn, no_stack_protector)) void __stack_chk_fail(void)
|
||||||
{
|
{
|
||||||
|
TaskingPanic();
|
||||||
error("Stack smashing detected!");
|
error("Stack smashing detected!");
|
||||||
KPrint("\eFF0000Stack smashing detected!");
|
KPrint("\eFF0000Stack smashing detected!");
|
||||||
#if defined(__amd64__) || defined(__i386__)
|
#if defined(__amd64__) || defined(__i386__)
|
||||||
@ -49,6 +50,7 @@ __attribute__((weak, noreturn, no_stack_protector)) void __stack_chk_fail(void)
|
|||||||
// https://github.com/gcc-mirror/gcc/blob/master/libssp/ssp.c
|
// https://github.com/gcc-mirror/gcc/blob/master/libssp/ssp.c
|
||||||
__attribute__((weak, noreturn, no_stack_protector)) void __chk_fail(void)
|
__attribute__((weak, noreturn, no_stack_protector)) void __chk_fail(void)
|
||||||
{
|
{
|
||||||
|
TaskingPanic();
|
||||||
error("Buffer overflow detected!");
|
error("Buffer overflow detected!");
|
||||||
KPrint("\eFF0000Buffer overflow detected!");
|
KPrint("\eFF0000Buffer overflow detected!");
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -79,7 +79,7 @@ EXTERNC void Entry(BootInfo *Info)
|
|||||||
}
|
}
|
||||||
KPrint("Enabling Interrupts on Bootstrap Processor");
|
KPrint("Enabling Interrupts on Bootstrap Processor");
|
||||||
Interrupts::Enable(0);
|
Interrupts::Enable(0);
|
||||||
#if defined(__amd64__)
|
#if defined(__amd64__)
|
||||||
PowerManager->InitDSDT();
|
PowerManager->InitDSDT();
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
// FIXME: Add ACPI support for i386
|
// FIXME: Add ACPI support for i386
|
||||||
@ -101,3 +101,9 @@ EXTERNC void Entry(BootInfo *Info)
|
|||||||
KPrint("\e058C19################################");
|
KPrint("\e058C19################################");
|
||||||
CPU::Halt(true);
|
CPU::Halt(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXTERNC void TaskingPanic()
|
||||||
|
{
|
||||||
|
if (TaskManager)
|
||||||
|
TaskManager->Panic();
|
||||||
|
}
|
||||||
|
1
kernel.h
1
kernel.h
@ -38,6 +38,7 @@ extern Disk::Manager *DiskManager;
|
|||||||
EXTERNC void putchar(char c);
|
EXTERNC void putchar(char c);
|
||||||
EXTERNC void KPrint(const char *format, ...);
|
EXTERNC void KPrint(const char *format, ...);
|
||||||
EXTERNC void Entry(struct BootInfo *Info);
|
EXTERNC void Entry(struct BootInfo *Info);
|
||||||
|
EXTERNC void TaskingPanic();
|
||||||
|
|
||||||
EXTERNC void KernelMainThread();
|
EXTERNC void KernelMainThread();
|
||||||
EXTERNC void KernelShutdownThread(bool Reboot);
|
EXTERNC void KernelShutdownThread(bool Reboot);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user