From 4f25c20c97c4eb00892e09494a99eaebdfecaaa7 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 30 Oct 2023 19:20:17 +0200 Subject: [PATCH] Kernel: Canonicalize vaddr before using it --- kernel/arch/x86_64/PageTable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/arch/x86_64/PageTable.cpp b/kernel/arch/x86_64/PageTable.cpp index bc2f4d40..d3c53570 100644 --- a/kernel/arch/x86_64/PageTable.cpp +++ b/kernel/arch/x86_64/PageTable.cpp @@ -580,8 +580,9 @@ namespace Kernel vaddr |= (uint64_t)pdpte << 30; vaddr |= (uint64_t)pde << 21; vaddr |= (uint64_t)pte << 12; + vaddr = canonicalize(vaddr); ASSERT(reserve_page(vaddr)); - return canonicalize(vaddr); + return vaddr; } } }