From 8ad46fd8f5a07c49d1a2cd40d22d748599f486e5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 13 Jan 2022 16:09:52 +0100 Subject: [PATCH] Kernel: Stop leaking executable path in successful sys$execve() Since we don't return from sys$execve() when it's successful, we have to take special care to tear down anything we've allocated. Turns out we were not doing this for the full executable path itself. --- Kernel/Syscalls/execve.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 55496cb369..a3777541b5 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -840,6 +840,12 @@ ErrorOr Process::exec(NonnullOwnPtr path, NonnullOwnPtrVector path_deleter = move(path); + } + // We need to enter the scheduler lock before changing the state // and it will be released after the context switch into that // thread. We should also still be in our critical section