From b7b7a48c66b56850b3ee8b5493f9964ef96859d2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Mar 2021 13:28:50 +0100 Subject: [PATCH] Kernel: Move process signal trampoline address into protected data --- Kernel/Process.h | 2 +- Kernel/Syscalls/execve.cpp | 3 ++- Kernel/Syscalls/fork.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Kernel/Process.h b/Kernel/Process.h index 6ff695547b7..0b6be73611a 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -118,6 +118,7 @@ protected: bool m_has_execpromises { false }; u32 m_execpromises { 0 }; mode_t m_umask { 022 }; + VirtualAddress m_signal_trampoline; }; class ProcessBase : public ProtectedProcessBase { @@ -544,7 +545,6 @@ private: String m_name; OwnPtr m_space; - VirtualAddress m_signal_trampoline; RefPtr m_pg; diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 803f610746e..63fb04c5e67 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -530,7 +530,6 @@ KResult Process::do_exec(NonnullRefPtr main_program_description } signal_trampoline_region.value()->set_syscall_region(true); - m_signal_trampoline = signal_trampoline_region.value()->vaddr(); m_executable = main_program_description->custody(); m_arguments = arguments; @@ -605,6 +604,8 @@ KResult Process::do_exec(NonnullRefPtr main_program_description m_execpromises = 0; m_has_execpromises = false; + m_signal_trampoline = signal_trampoline_region.value()->vaddr(); + // FIXME: PID/TID ISSUE m_pid = new_main_thread->tid().value(); } diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp index 4016206d182..102345800b3 100644 --- a/Kernel/Syscalls/fork.cpp +++ b/Kernel/Syscalls/fork.cpp @@ -44,7 +44,6 @@ KResultOr Process::sys$fork(RegisterState& regs) child->m_veil_state = m_veil_state; child->m_unveiled_paths = m_unveiled_paths.deep_copy(); child->m_fds = m_fds; - child->m_signal_trampoline = m_signal_trampoline; child->m_pg = m_pg; { @@ -56,6 +55,7 @@ KResultOr Process::sys$fork(RegisterState& regs) child->m_sid = m_sid; child->m_extra_gids = m_extra_gids; child->m_umask = m_umask; + child->m_signal_trampoline = m_signal_trampoline; } dbgln_if(FORK_DEBUG, "fork: child={}", child);