[PATCH 2/9] proc: add proc_file_private struct to store private information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to store and to track the private information specific to each
procfs opened file we convert the 'proc_maps_private' struct which is used
by the /proc/$pid/{maps,smaps,numa_maps} files to 'proc_file_private'
which can now be used by all the /proc/<pid>/* and even other /proc/* files
to store private information that must be kept across syscalls.

The proc_file_private struct includes an exec_id member which can be used
to track and to protect special and sensitive procfs files. In general it
will be set at open time to the task's exec_id to bind the file to this
task.

The proc_file_private struct offers the way to make the checks and to
bind special procfs files to the appropriate task in a consistent and
unified way.

Cc: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>
Cc: Solar Designer <solar@xxxxxxxxxxxx>
Signed-off-by: Djalal Harouni <tixxdz@xxxxxxxxxx>
---
 fs/proc/internal.h |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 2925775..a8968f6 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -61,10 +61,19 @@ extern const struct file_operations proc_pagemap_operations;
 extern const struct file_operations proc_net_operations;
 extern const struct inode_operations proc_net_inode_operations;
 
-struct proc_maps_private {
+/*
+ * Internal proc_file_private is used to track procfs files being
+ * processed especially the ones that varies during runtime.
+ */
+struct proc_file_private {
+	/* The Execve ID of the task, use this to protect special procfs
+	 * files. Must be set at open time. */
+	u64 exec_id;
 	struct pid *pid;
+	struct inode *inode;
 	struct task_struct *task;
 #ifdef CONFIG_MMU
+	/* For /proc/pid/{maps,smaps...} */
 	struct vm_area_struct *tail_vma;
 #endif
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux