浏览代码

Kernel: fork()ed children should inherit pledge promises :^)

Update various places that now need wider promises as they are not
reset by fork() anymore.
Andreas Kling 5 年之前
父节点
当前提交
f187374c1b

+ 2 - 2
Applications/Taskbar/main.cpp

@@ -5,14 +5,14 @@
 
 
 int main(int argc, char** argv)
 int main(int argc, char** argv)
 {
 {
-    if (pledge("stdio shared_buffer proc rpath unix cpath fattr", nullptr) < 0) {
+    if (pledge("stdio shared_buffer proc exec rpath unix cpath fattr", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }
 
 
     GApplication app(argc, argv);
     GApplication app(argc, argv);
 
 
-    if (pledge("stdio shared_buffer proc rpath unix", nullptr) < 0) {
+    if (pledge("stdio shared_buffer proc exec rpath unix", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }

+ 2 - 2
Applications/Terminal/main.cpp

@@ -136,7 +136,7 @@ RefPtr<GWindow> create_settings_window(TerminalWidget& terminal, RefPtr<CConfigF
 
 
 int main(int argc, char** argv)
 int main(int argc, char** argv)
 {
 {
-    if (pledge("stdio tty rpath cpath wpath shared_buffer proc unix fattr", nullptr) < 0) {
+    if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec unix fattr", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }
@@ -153,7 +153,7 @@ int main(int argc, char** argv)
 
 
     GApplication app(argc, argv);
     GApplication app(argc, argv);
 
 
-    if (pledge("stdio tty rpath cpath wpath shared_buffer proc unix", nullptr) < 0) {
+    if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec unix", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }

+ 2 - 0
Kernel/Process.cpp

@@ -599,6 +599,8 @@ pid_t Process::sys$fork(RegisterDump& regs)
     Thread* child_first_thread = nullptr;
     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);
     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 = m_root_directory;
+    child->m_promises = m_promises;
+    child->m_execpromises = m_execpromises;
 
 
 #ifdef FORK_DEBUG
 #ifdef FORK_DEBUG
     dbgprintf("fork: child=%p\n", child);
     dbgprintf("fork: child=%p\n", child);

+ 1 - 1
Servers/SystemServer/main.cpp

@@ -77,7 +77,7 @@ static void mount_all_filesystems()
 
 
 int main(int, char**)
 int main(int, char**)
 {
 {
-    if (pledge("stdio proc exec unix rpath cpath chown fattr id", nullptr) < 0) {
+    if (pledge("stdio proc exec unix rpath wpath cpath chown fattr id", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }

+ 2 - 2
Servers/WindowServer/main.cpp

@@ -10,7 +10,7 @@
 
 
 int main(int, char**)
 int main(int, char**)
 {
 {
-    if (pledge("stdio shared_buffer rpath wpath cpath unix proc fattr", nullptr) < 0) {
+    if (pledge("stdio shared_buffer rpath wpath cpath unix proc exec fattr", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }
@@ -35,7 +35,7 @@ int main(int, char**)
 
 
     WSEventLoop loop;
     WSEventLoop loop;
 
 
-    if (pledge("stdio shared_buffer rpath wpath cpath unix proc", nullptr) < 0) {
+    if (pledge("stdio shared_buffer rpath wpath cpath unix proc exec", nullptr) < 0) {
         perror("pledge");
         perror("pledge");
         return 1;
         return 1;
     }
     }