diff options
author | Liav A <liavalb@gmail.com> | 2021-06-23 10:29:15 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-29 20:53:59 +0200 |
commit | d79d9e833ecc551e63f4caf4f114206faeafae4f (patch) | |
tree | 8218b2d3ba73066255649867d174668174362c54 | |
parent | 47149e625faf4c970155ec923a2701ac2756e2cd (diff) | |
download | serenity-d79d9e833ecc551e63f4caf4f114206faeafae4f.zip |
Kernel/ProcFS: Tighten permissions on the exposed objects
This is needed so we properly set the limits for different objects in
the filesystem.
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index aae7bbfbe4..4f5cd3968b 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -142,8 +142,8 @@ InodeMetadata ProcFSInode::metadata() const InodeMetadata metadata; metadata.inode = { fsid(), m_associated_component->component_index() }; metadata.mode = m_associated_component->required_mode(); - metadata.uid = 0; - metadata.gid = 0; + metadata.uid = m_associated_component->owner_user(); + metadata.gid = m_associated_component->owner_group(); metadata.size = m_associated_component->size(); metadata.mtime = mepoch; return metadata; @@ -212,9 +212,9 @@ InodeMetadata ProcFSDirectoryInode::metadata() const Locker locker(m_lock); InodeMetadata metadata; metadata.inode = { fsid(), m_associated_component->component_index() }; - metadata.mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXOTH; - metadata.uid = 0; - metadata.gid = 0; + metadata.mode = S_IFDIR | m_associated_component->required_mode(); + metadata.uid = m_associated_component->owner_user(); + metadata.gid = m_associated_component->owner_group(); metadata.size = 0; metadata.mtime = mepoch; return metadata; @@ -255,8 +255,8 @@ InodeMetadata ProcFSLinkInode::metadata() const InodeMetadata metadata; metadata.inode = { fsid(), m_associated_component->component_index() }; metadata.mode = S_IFLNK | m_associated_component->required_mode(); - metadata.uid = 0; - metadata.gid = 0; + metadata.uid = m_associated_component->owner_user(); + metadata.gid = m_associated_component->owner_group(); metadata.size = 0; metadata.mtime = mepoch; return metadata; |