Kernel: Validate pointer's when printing stack trace

There was an kernel panic if stack trace contained uncanonical
addresses.
This commit is contained in:
Bananymous 2024-09-22 17:16:01 +03:00
parent ae89237453
commit 57aec2a733
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,12 @@ namespace Debug
BAN::Formatter::print(Debug::putchar, "\e[36mStack trace:\r\n");
while (frame)
{
if (!PageTable::is_valid_pointer((vaddr_t)frame))
{
derrorln("invalid pointer {H}", (vaddr_t)frame);
break;
}
if (PageTable::current().is_page_free((vaddr_t)frame & PAGE_ADDR_MASK))
{
derrorln(" {} not mapped", frame);