From 889ecd137503572cda8e6171c5fc6c3c35f11d01 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 3 Jan 2020 04:14:41 +0100 Subject: [PATCH] Kernel: The superuser is allowed to utime() on any file Before this patch, root was not able to "touch" someone else's file. --- Kernel/FileSystem/VirtualFileSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 377bb14e93..7d66f0c604 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -163,7 +163,7 @@ KResult VFS::utime(StringView path, Custody& base, time_t atime, time_t mtime) auto& inode = *descriptor_or_error.value()->inode(); if (inode.fs().is_readonly()) return KResult(-EROFS); - if (inode.metadata().uid != current->process().euid()) + if (!current->process().is_superuser() && inode.metadata().uid != current->process().euid()) return KResult(-EACCES); int error = inode.set_atime(atime);