Преглед на файлове

Kernel: Require "tty" for ioctl() on TTY and MasterPTY

SystemServer now pledges "tty" since it's used when spawning services.
Andreas Kling преди 5 години
родител
ревизия
62a191b59a
променени са 3 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 1 0
      Kernel/TTY/MasterPTY.cpp
  2. 1 0
      Kernel/TTY/TTY.cpp
  3. 1 1
      Servers/SystemServer/main.cpp

+ 1 - 0
Kernel/TTY/MasterPTY.cpp

@@ -98,6 +98,7 @@ void MasterPTY::close()
 
 int MasterPTY::ioctl(FileDescription& description, unsigned request, unsigned arg)
 {
+    REQUIRE_PROMISE(tty);
     if (!m_slave)
         return -EIO;
     if (request == TIOCSWINSZ || request == TIOCGPGRP)

+ 1 - 0
Kernel/TTY/TTY.cpp

@@ -242,6 +242,7 @@ void TTY::set_termios(const termios& t)
 
 int TTY::ioctl(FileDescription&, unsigned request, unsigned arg)
 {
+    REQUIRE_PROMISE(tty);
     auto& process = current->process();
     pid_t pgid;
     termios* tp;

+ 1 - 1
Servers/SystemServer/main.cpp

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