Browse Source

Kernel: Make /proc/PID directories owned by the EUID:EGID

This is instead of the UID:GID, since that was allowing some very bad
information leaks like spawning "su" as an unprivileged user and having
full /proc access to it.

Work towards #4504.
Andreas Kling 4 năm trước cách đây
mục cha
commit
3c9bd911b8
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      Kernel/FileSystem/ProcFS.cpp

+ 4 - 4
Kernel/FileSystem/ProcFS.cpp

@@ -1138,8 +1138,8 @@ InodeMetadata ProcFSInode::metadata() const
         ProcessID pid = to_pid(identifier());
         auto process = Process::from_pid(pid);
         if (process) {
-            metadata.uid = process->sys$getuid();
-            metadata.gid = process->sys$getgid();
+            metadata.uid = process->euid();
+            metadata.gid = process->egid();
         } else {
             // TODO: How to handle this?
             metadata.uid = 0;
@@ -1149,8 +1149,8 @@ InodeMetadata ProcFSInode::metadata() const
         ThreadID tid = to_tid(identifier());
         auto thread = Thread::from_tid(tid);
         if (thread) {
-            metadata.uid = thread->process().sys$getuid();
-            metadata.gid = thread->process().sys$getgid();
+            metadata.uid = thread->process().euid();
+            metadata.gid = thread->process().egid();
         } else {
             // TODO: How to handle this?
             metadata.uid = 0;