From bd95f1742690d9def87fc962e624ab41699cd77f Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 25 Apr 2023 13:40:55 +0300 Subject: [PATCH] Kernel: Stack pointer out of bounds now panics with a message --- kernel/include/kernel/Thread.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/include/kernel/Thread.h b/kernel/include/kernel/Thread.h index 9a1dd539..cd7a86e1 100644 --- a/kernel/include/kernel/Thread.h +++ b/kernel/include/kernel/Thread.h @@ -55,7 +55,12 @@ namespace Kernel private: Thread(pid_t tid, Process*); - void validate_stack() const { if (!m_in_syscall) ASSERT(stack_base() <= m_rsp && m_rsp <= stack_base() + stack_size()); } + void validate_stack() const + { + if (!m_in_syscall) + if (!(stack_base() <= m_rsp && m_rsp <= stack_base() + stack_size())) + Kernel::panic("rsp {8H}, stack {8H}->{8H}", m_rsp, stack_base(), stack_base() + stack_size()); + } BAN::ErrorOr initialize(entry_t, void*); void on_exit();