From c9d7fc6ec603bf549829983291662649b98e6665 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 27 Feb 2019 12:34:43 +0100 Subject: [PATCH] Kernel: chmod() should allow superuser to change mode bits of any file. --- Kernel/VirtualFileSystem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel/VirtualFileSystem.cpp b/Kernel/VirtualFileSystem.cpp index 21b604159a..45acec8e89 100644 --- a/Kernel/VirtualFileSystem.cpp +++ b/Kernel/VirtualFileSystem.cpp @@ -300,8 +300,7 @@ KResult VFS::chmod(const String& path, mode_t mode, Inode& base) if (inode->fs().is_readonly()) return KResult(-EROFS); - // FIXME: Superuser should always be allowed to chmod. - if (current->euid() != inode->metadata().uid) + if (current->euid() != inode->metadata().uid && !current->is_superuser()) return KResult(-EPERM); // Only change the permission bits.