From d745fca86aa1e04a04b506e59694a3dd79e115eb Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 22 Aug 2023 14:53:46 +0300 Subject: [PATCH] Kernel: Process keeps track if forked process has called exec*() --- kernel/include/kernel/Process.h | 2 ++ kernel/kernel/Process.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/kernel/include/kernel/Process.h b/kernel/include/kernel/Process.h index cf46147228..152d887548 100644 --- a/kernel/include/kernel/Process.h +++ b/kernel/include/kernel/Process.h @@ -180,6 +180,8 @@ namespace Kernel userspace_info_t m_userspace_info; ExitStatus m_exit_status; + bool m_has_called_exec { false }; + BAN::UniqPtr m_page_table; BAN::RefPtr m_controlling_terminal; diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index d894025f6c..711120eb38 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -381,6 +381,7 @@ namespace Kernel forked->m_general_allocator = BAN::move(general_allocator); forked->m_is_userspace = m_is_userspace; forked->m_userspace_info = m_userspace_info; + forked->m_has_called_exec = false; memcpy(forked->m_signal_handlers, m_signal_handlers, sizeof(m_signal_handlers)); ASSERT(this == &Process::current()); @@ -586,6 +587,8 @@ namespace Kernel ASSERT_NOT_REACHED(); } } + + m_has_called_exec = true; } BAN::ErrorOr Process::sys_open(BAN::StringView path, int flags, mode_t mode)