From 69f13f1896c29f645c352e3ec8d250a9b8397561 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 11 Apr 2023 23:29:21 +0300 Subject: [PATCH] Kernel: Scheduler will panic if it encounters stack overflow --- kernel/kernel/Scheduler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/kernel/Scheduler.cpp b/kernel/kernel/Scheduler.cpp index 728503cf..0f5e8dc8 100644 --- a/kernel/kernel/Scheduler.cpp +++ b/kernel/kernel/Scheduler.cpp @@ -157,6 +157,9 @@ namespace Kernel Thread& current = current_thread(); current.set_rip(rip); current.set_rsp(rsp); + + ASSERT(current.stack_base() <= rsp && rsp <= current.stack_base() + current.stack_size()); + return false; }