From 573664758a553a42c7db936b3c547bd457141478 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Sun, 6 Jun 2021 23:23:00 +0200 Subject: [PATCH] Kernel: Properly reset m_unveiled_paths on execve() When a process executes another program, its unveil state is reset. For this, we not only need to clear all nodes from m_unveiled_paths, but also reset the metadata of m_unveiled_paths (the root node) itself. This fixes the following bug: 1) A process unveils "/", then executes another program. 2) That other program also unveils some path. 3) "/" is now unveiled for the new program. --- Kernel/Syscalls/execve.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 8c4a9179fa..73a15931d1 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -553,6 +553,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_description m_veil_state = VeilState::None; m_unveiled_paths.clear(); + m_unveiled_paths.set_metadata({ "/", UnveilAccess::None, false }); m_coredump_metadata.clear();