[NETLINK]: Encapsulate eff_cap usage within security framework.
[deliverable/linux.git] / include / linux / security.h
index 47722d3555320a5a5aedaa14c6feed63deacdb57..c7ea15716dce5cdcc5c293c120471a99248fa669 100644 (file)
@@ -67,7 +67,7 @@ struct xfrm_state;
 struct xfrm_user_sec_ctx;
 
 extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
-extern int cap_netlink_recv(struct sk_buff *skb);
+extern int cap_netlink_recv(struct sk_buff *skb, int cap);
 
 /*
  * Values used in the task_security_ops calls
@@ -171,9 +171,9 @@ struct swap_info_struct;
  *     Deallocate and clear the sb->s_security field.
  *     @sb contains the super_block structure to be modified.
  * @sb_statfs:
- *     Check permission before obtaining filesystem statistics for the @sb
- *     filesystem.
- *     @sb contains the super_block structure for the filesystem.
+ *     Check permission before obtaining filesystem statistics for the @mnt
+ *     mountpoint.
+ *     @dentry is a handle on the superblock for the filesystem.
  *     Return 0 if permission is granted.  
  * @sb_mount:
  *     Check permission before an object specified by @dev_name is mounted on
@@ -577,6 +577,11 @@ struct swap_info_struct;
  *     @p contains the task_struct of process.
  *     @nice contains the new nice value.
  *     Return 0 if permission is granted.
+ * @task_setioprio
+ *     Check permission before setting the ioprio value of @p to @ioprio.
+ *     @p contains the task_struct of process.
+ *     @ioprio contains the new ioprio value
+ *     Return 0 if permission is granted.
  * @task_setrlimit:
  *     Check permission before setting the resource limits of the current
  *     process for @resource to @new_rlim.  The old resource limit values can
@@ -596,6 +601,10 @@ struct swap_info_struct;
  *     @p.
  *     @p contains the task_struct for process.
  *     Return 0 if permission is granted.
+ * @task_movememory
+ *     Check permission before moving memory owned by process @p.
+ *     @p contains the task_struct for process.
+ *     Return 0 if permission is granted.
  * @task_kill:
  *     Check permission before sending signal @sig to @p.  @info can be NULL,
  *     the constant 1, or a pointer to a siginfo structure.  If @info is 1 or
@@ -647,6 +656,7 @@ struct swap_info_struct;
  *     Check permission before processing the received netlink message in
  *     @skb.
  *     @skb contains the sk_buff structure for the netlink message.
+ *     @cap indicates the capability required
  *     Return 0 if permission is granted.
  *
  * Security hooks for Unix domain networking.
@@ -853,6 +863,7 @@ struct swap_info_struct;
  *     Permit allocation of a key and assign security data. Note that key does
  *     not have a serial number assigned at this point.
  *     @key points to the key.
+ *     @flags is the allocation flags
  *     Return 0 if permission is granted, -ve error otherwise.
  * @key_free:
  *     Notification of destruction; free security data.
@@ -1127,7 +1138,7 @@ struct security_operations {
        int (*sb_copy_data)(struct file_system_type *type,
                            void *orig, void *copy);
        int (*sb_kern_mount) (struct super_block *sb, void *data);
-       int (*sb_statfs) (struct super_block * sb);
+       int (*sb_statfs) (struct dentry *dentry);
        int (*sb_mount) (char *dev_name, struct nameidata * nd,
                         char *type, unsigned long flags, void *data);
        int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
@@ -1210,10 +1221,12 @@ struct security_operations {
        int (*task_getsid) (struct task_struct * p);
        int (*task_setgroups) (struct group_info *group_info);
        int (*task_setnice) (struct task_struct * p, int nice);
+       int (*task_setioprio) (struct task_struct * p, int ioprio);
        int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
        int (*task_setscheduler) (struct task_struct * p, int policy,
                                  struct sched_param * lp);
        int (*task_getscheduler) (struct task_struct * p);
+       int (*task_movememory) (struct task_struct * p);
        int (*task_kill) (struct task_struct * p,
                          struct siginfo * info, int sig);
        int (*task_wait) (struct task_struct * p);
@@ -1254,7 +1267,7 @@ struct security_operations {
                          struct sembuf * sops, unsigned nsops, int alter);
 
        int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
-       int (*netlink_recv) (struct sk_buff * skb);
+       int (*netlink_recv) (struct sk_buff * skb, int cap);
 
        /* allow module stacking */
        int (*register_security) (const char *name,
@@ -1313,7 +1326,7 @@ struct security_operations {
 
        /* key management security hooks */
 #ifdef CONFIG_KEYS
-       int (*key_alloc)(struct key *key, struct task_struct *tsk);
+       int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags);
        void (*key_free)(struct key *key);
        int (*key_permission)(key_ref_t key_ref,
                              struct task_struct *context,
@@ -1450,9 +1463,9 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
        return security_ops->sb_kern_mount (sb, data);
 }
 
-static inline int security_sb_statfs (struct super_block *sb)
+static inline int security_sb_statfs (struct dentry *dentry)
 {
-       return security_ops->sb_statfs (sb);
+       return security_ops->sb_statfs (dentry);
 }
 
 static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
@@ -1836,6 +1849,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice)
        return security_ops->task_setnice (p, nice);
 }
 
+static inline int security_task_setioprio (struct task_struct *p, int ioprio)
+{
+       return security_ops->task_setioprio (p, ioprio);
+}
+
 static inline int security_task_setrlimit (unsigned int resource,
                                           struct rlimit *new_rlim)
 {
@@ -1854,6 +1872,11 @@ static inline int security_task_getscheduler (struct task_struct *p)
        return security_ops->task_getscheduler (p);
 }
 
+static inline int security_task_movememory (struct task_struct *p)
+{
+       return security_ops->task_movememory (p);
+}
+
 static inline int security_task_kill (struct task_struct *p,
                                      struct siginfo *info, int sig)
 {
@@ -2010,9 +2033,9 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
        return security_ops->netlink_send(sk, skb);
 }
 
-static inline int security_netlink_recv(struct sk_buff * skb)
+static inline int security_netlink_recv(struct sk_buff * skb, int cap)
 {
-       return security_ops->netlink_recv(skb);
+       return security_ops->netlink_recv(skb, cap);
 }
 
 /* prototypes */
@@ -2162,7 +2185,7 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
        return 0;
 }
 
-static inline int security_sb_statfs (struct super_block *sb)
+static inline int security_sb_statfs (struct dentry *dentry)
 {
        return 0;
 }
@@ -2478,6 +2501,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice)
        return 0;
 }
 
+static inline int security_task_setioprio (struct task_struct *p, int ioprio)
+{
+       return 0;
+}
+
 static inline int security_task_setrlimit (unsigned int resource,
                                           struct rlimit *new_rlim)
 {
@@ -2496,6 +2524,11 @@ static inline int security_task_getscheduler (struct task_struct *p)
        return 0;
 }
 
+static inline int security_task_movememory (struct task_struct *p)
+{
+       return 0;
+}
+
 static inline int security_task_kill (struct task_struct *p,
                                      struct siginfo *info, int sig)
 {
@@ -2638,9 +2671,9 @@ static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
        return cap_netlink_send (sk, skb);
 }
 
-static inline int security_netlink_recv (struct sk_buff *skb)
+static inline int security_netlink_recv (struct sk_buff *skb, int cap)
 {
-       return cap_netlink_recv (skb);
+       return cap_netlink_recv (skb, cap);
 }
 
 static inline struct dentry *securityfs_create_dir(const char *name,
@@ -3009,9 +3042,10 @@ static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid
 #ifdef CONFIG_KEYS
 #ifdef CONFIG_SECURITY
 static inline int security_key_alloc(struct key *key,
-                                    struct task_struct *tsk)
+                                    struct task_struct *tsk,
+                                    unsigned long flags)
 {
-       return security_ops->key_alloc(key, tsk);
+       return security_ops->key_alloc(key, tsk, flags);
 }
 
 static inline void security_key_free(struct key *key)
@@ -3029,7 +3063,8 @@ static inline int security_key_permission(key_ref_t key_ref,
 #else
 
 static inline int security_key_alloc(struct key *key,
-                                    struct task_struct *tsk)
+                                    struct task_struct *tsk,
+                                    unsigned long flags)
 {
        return 0;
 }
This page took 0.029649 seconds and 5 git commands to generate.