From 7c18b8678137a382f59b361ecd4813484bdfb77e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 27 Feb 2019 17:08:13 +0100 Subject: [PATCH] Kernel: Allow uid 0 to read/write/execute any file. --- Kernel/InodeMetadata.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/InodeMetadata.h b/Kernel/InodeMetadata.h index 4a964b44cf..ee24330f9d 100644 --- a/Kernel/InodeMetadata.h +++ b/Kernel/InodeMetadata.h @@ -26,6 +26,8 @@ struct InodeMetadata { bool may_read(uid_t u, const HashTable& g) const { + if (u == 0) + return true; if (uid == u) return mode & 0400; if (g.contains(gid)) @@ -35,6 +37,8 @@ struct InodeMetadata { bool may_write(uid_t u, const HashTable& g) const { + if (u == 0) + return true; if (uid == u) return mode & 0200; if (g.contains(gid)) @@ -44,6 +48,8 @@ struct InodeMetadata { bool may_execute(uid_t u, const HashTable& g) const { + if (u == 0) + return true; if (uid == u) return mode & 0100; if (g.contains(gid))