summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-25 01:12:17 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-25 01:12:17 -0700
commit20378c297ea5692ed9e347778c63ac09d8bcc2e2 (patch)
tree290a8248ec4d339fc06c1af3543d881c96134847 /include
parent09d35c2a24ba41f7fe356e775ebe2dd6e2a48837 (diff)
[PATCH] /proc/pid inode security labels
From: Stephen Smalley <sds@epoch.ncsc.mil> This patch against 2.5.69-bk adds a hook to proc_pid_make_inode to allow security modules to set the security attributes on /proc/pid inodes based on the security attributes of the associated task. This is required by SELinux in order to control access to the process state accessible via /proc/pid inodes in accordance with the task's security label. An alternative approach that was considered was to implement an xattr handler for /proc/pid inodes. That approach would still require a hook call from the xattr handler to the security module to obtain an xattr value based on the task security attributes, so it would add a further level of indirection/translation. The only benefit of implementing an xattr handler for the /proc/pid inodes would be that the /proc/pid inode security labels could then be exported to userspace. However, the /proc/pid inode security labels are only used internally by the security module for access control purposes, and userspace access to the full range of process attributes is already provided via the /proc/pid/attr interface. Consequently, a simple hook in proc_pid_make_inode seemed preferable.
Diffstat (limited to 'include')
-rw-r--r--include/linux/security.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index faaa1780f93e..5c041e89a505 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -596,6 +596,11 @@ struct swap_info_struct;
* Set the security attributes in @p->security for a kernel thread that
* is being reparented to the init task.
* @p contains the task_struct for the kernel thread.
+ * @task_to_inode:
+ * Set the security attributes for an inode based on an associated task's
+ * security attributes, e.g. for /proc/pid inodes.
+ * @p contains the task_struct for the task.
+ * @inode contains the inode structure for the inode.
*
* Security hooks for Netlink messaging.
*
@@ -1086,6 +1091,7 @@ struct security_operations {
unsigned long arg5);
void (*task_kmod_set_label) (void);
void (*task_reparent_to_init) (struct task_struct * p);
+ void (*task_to_inode)(struct task_struct *p, struct inode *inode);
int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
@@ -1659,6 +1665,11 @@ static inline void security_task_reparent_to_init (struct task_struct *p)
security_ops->task_reparent_to_init (p);
}
+static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
+{
+ security_ops->task_to_inode(p, inode);
+}
+
static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
short flag)
{
@@ -2268,6 +2279,9 @@ static inline void security_task_reparent_to_init (struct task_struct *p)
cap_task_reparent_to_init (p);
}
+static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
+{ }
+
static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
short flag)
{