diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index e14c8d65ba..0d18496243 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -577,7 +577,7 @@ Optional procfs$pid_root(InodeIdentifier identifier) auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier)); if (!handle) return {}; - return handle->process().root_directory_for_procfs().absolute_path().to_byte_buffer(); + return handle->process().root_directory_relative_to_global_root().absolute_path().to_byte_buffer(); } Optional procfs$self(InodeIdentifier) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 8f5800728c..3fb0cac1a8 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -578,6 +578,7 @@ pid_t Process::sys$fork(RegisterDump& regs) Thread* child_first_thread = nullptr; auto* child = new Process(child_first_thread, m_name, m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this); child->m_root_directory = m_root_directory; + child->m_root_directory_relative_to_global_root = m_root_directory_relative_to_global_root; child->m_promises = m_promises; child->m_execpromises = m_execpromises; @@ -2769,6 +2770,7 @@ void Process::finalize() m_executable = nullptr; m_cwd = nullptr; m_root_directory = nullptr; + m_root_directory_relative_to_global_root = nullptr; m_elf_loader = nullptr; disown_all_shared_buffers(); @@ -4325,7 +4327,7 @@ int Process::sys$set_process_boost(pid_t pid, int amount) return 0; } -int Process::sys$chroot(const char* user_path, size_t path_length) +int Process::sys$chroot(const char* user_path, size_t path_length, int mount_flags) { if (!is_superuser()) return -EPERM; @@ -4350,11 +4352,11 @@ Custody& Process::root_directory() return *m_root_directory; } -Custody& Process::root_directory_for_procfs() +Custody& Process::root_directory_relative_to_global_root() { - if (!m_root_directory_for_procfs) - m_root_directory_for_procfs = root_directory(); - return *m_root_directory_for_procfs; + if (!m_root_directory_relative_to_global_root) + m_root_directory_relative_to_global_root = root_directory(); + return *m_root_directory_relative_to_global_root; } void Process::set_root_directory(const Custody& root) diff --git a/Kernel/Process.h b/Kernel/Process.h index 5921e30703..429b449952 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -339,7 +339,7 @@ public: u32 priority_boost() const { return m_priority_boost; } Custody& root_directory(); - Custody& root_directory_for_procfs(); + Custody& root_directory_relative_to_global_root(); void set_root_directory(const Custody&); bool has_promises() const { return m_promises; } @@ -407,7 +407,7 @@ private: RefPtr m_executable; RefPtr m_cwd; RefPtr m_root_directory; - RefPtr m_root_directory_for_procfs; + RefPtr m_root_directory_relative_to_global_root; RefPtr m_tty;