From 07141434e0ef2e2ffcd1ba7c8a1d9d26a8d00453 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 28 Jul 2021 18:59:53 +0200 Subject: [PATCH] Kernel/ProcFS: Make various things superuser-only once again File and directory permissions regressed with the recent ProcFS changes. This patch restores the superuser-only permissions where appropriate. --- Kernel/GlobalProcessExposed.cpp | 6 ++++++ Kernel/ProcessExposed.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp index 6cdb3f2a7d0..95cc13eca7a 100644 --- a/Kernel/GlobalProcessExposed.cpp +++ b/Kernel/GlobalProcessExposed.cpp @@ -539,6 +539,8 @@ class ProcFSDmesg final : public ProcFSGlobalInformation { public: static NonnullRefPtr must_create(); + virtual mode_t required_mode() const override { return 0400; } + private: ProcFSDmesg(); virtual bool output(KBufferBuilder& builder) override @@ -670,6 +672,8 @@ class ProcFSModules final : public ProcFSGlobalInformation { public: static NonnullRefPtr must_create(); + virtual mode_t required_mode() const override { return 0400; } + private: ProcFSModules(); virtual bool output(KBufferBuilder& builder) override @@ -695,6 +699,8 @@ class ProcFSProfile final : public ProcFSGlobalInformation { public: static NonnullRefPtr must_create(); + virtual mode_t required_mode() const override { return 0400; } + private: ProcFSProfile(); virtual bool output(KBufferBuilder& builder) override diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h index 5c4d325342a..527898d72bc 100644 --- a/Kernel/ProcessExposed.h +++ b/Kernel/ProcessExposed.h @@ -143,6 +143,7 @@ public: virtual gid_t owner_group() const override { return m_associated_process ? m_associated_process->gid() : 0; } virtual KResult refresh_data(FileDescription&) const override; virtual RefPtr lookup(StringView name) override; + virtual mode_t required_mode() const override { return 0500; } virtual void prepare_for_deletion() override; @@ -234,6 +235,8 @@ public: return process->gid(); } + virtual mode_t required_mode() const override { return 0400; } + protected: ProcFSProcessInformation(StringView name, const ProcFSProcessDirectory& process_directory) : ProcFSExposedComponent(name)