Browse Source

Kernel: The root inode of a TmpFS should have the sticky bit set

We were running without the sticky bit and mode 777, which meant that
the /tmp directory was world-writable *without* protection.

With this fixed, it's no longer possible for everyone to steal root's
files in /tmp.
Andreas Kling 5 years ago
parent
commit
e79c33eabb
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Kernel/FileSystem/TmpFS.cpp

+ 1 - 1
Kernel/FileSystem/TmpFS.cpp

@@ -121,7 +121,7 @@ NonnullRefPtr<TmpFSInode> TmpFSInode::create(TmpFS& fs, InodeMetadata metadata,
 NonnullRefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs)
 {
     InodeMetadata metadata;
-    metadata.mode = 0040777;
+    metadata.mode = 0041777;
     return create(fs, metadata, { fs.fsid(), 1 });
 }