From d7ccea8f1889654d75f9dc3d863887447cb22530 Mon Sep 17 00:00:00 2001 From: Xuewei Niu Date: Wed, 19 Oct 2022 17:25:09 +0800 Subject: [PATCH] fix(os): fix kstack leak issues The kstack_id is not recycled when KernelStack is dropped, which leads to kstack leak issue. Ch8 branch, and branches after that, are also affected by this issue. Signed-off-by: Xuewei Niu --- os/src/task/id.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/os/src/task/id.rs b/os/src/task/id.rs index c1771813..23ddf7b5 100644 --- a/os/src/task/id.rs +++ b/os/src/task/id.rs @@ -87,6 +87,7 @@ impl Drop for KernelStack { KERNEL_SPACE .exclusive_access() .remove_area_with_start_vpn(kernel_stack_bottom_va.into()); + KSTACK_ALLOCATOR.exclusive_access().dealloc(self.0); } }