[PATCH] Remove ->rq_status from struct request
[safe/jmp/linux-2.6] / include / linux / security.h
index 627382e..9b5fea8 100644 (file)
@@ -30,6 +30,9 @@
 #include <linux/shm.h>
 #include <linux/msg.h>
 #include <linux/sched.h>
+#include <linux/key.h>
+#include <linux/xfrm.h>
+#include <net/flow.h>
 
 struct ctl_table;
 
@@ -58,9 +61,15 @@ struct sk_buff;
 struct sock;
 struct sockaddr;
 struct socket;
+struct flowi;
+struct dst_entry;
+struct xfrm_selector;
+struct xfrm_policy;
+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
@@ -81,6 +90,7 @@ extern int cap_netlink_recv(struct sk_buff *skb);
 struct nfsctl_arg;
 struct sched_param;
 struct swap_info_struct;
+struct request_sock;
 
 /* bprm_apply_creds unsafe reasons */
 #define LSM_UNSAFE_SHARE       1
@@ -164,9 +174,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
@@ -385,6 +395,9 @@ struct swap_info_struct;
  *     NULL to request the size of the buffer required.  @size indicates
  *     the size of @buffer in bytes.  Note that @name is the remainder
  *     of the attribute name after the security. prefix has been removed.
+ *     @err is the return value from the preceding fs getxattr call,
+ *     and can be used by the security module to determine whether it
+ *     should try and canonicalize the attribute value.
  *     Return number of bytes used/required on success.
  * @inode_setsecurity:
  *     Set the security label associated with @name for @inode from the
@@ -557,6 +570,9 @@ struct swap_info_struct;
  *     @p.
  *     @p contains the task_struct for the process.
  *     Return 0 if permission is granted.
+ * @task_getsecid:
+ *     Retrieve the security identifier of the process @p.
+ *     @p contains the task_struct for the process and place is into @secid.
  * @task_setgroups:
  *     Check permission before setting the supplementary group set of the
  *     current process.
@@ -567,6 +583,15 @@ 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_getioprio
+ *     Check permission before getting the ioprio value of @p.
+ *     @p contains the task_struct of process.
+ *     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
@@ -586,6 +611,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
@@ -596,6 +625,7 @@ struct swap_info_struct;
  *     @p contains the task_struct for process.
  *     @info contains the signal information.
  *     @sig contains the signal value.
+ *     @secid contains the sid of the process where the signal originated
  *     Return 0 if permission is granted.
  * @task_wait:
  *     Check permission before allowing a process to reap a child process @p
@@ -637,6 +667,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.
@@ -784,6 +815,110 @@ struct swap_info_struct;
  *      which is used to copy security attributes between local stream sockets.
  * @sk_free_security:
  *     Deallocate security structure.
+ * @sk_clone_security:
+ *     Clone/copy security structure.
+ * @sk_getsecid:
+ *     Retrieve the LSM-specific secid for the sock to enable caching of network
+ *     authorizations.
+ * @sock_graft:
+ *     Sets the socket's isec sid to the sock's sid.
+ * @inet_conn_request:
+ *     Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
+ * @inet_csk_clone:
+ *     Sets the new child socket's sid to the openreq sid.
+ * @req_classify_flow:
+ *     Sets the flow's sid to the openreq sid.
+ *
+ * Security hooks for XFRM operations.
+ *
+ * @xfrm_policy_alloc_security:
+ *     @xp contains the xfrm_policy being added to Security Policy Database
+ *     used by the XFRM system.
+ *     @sec_ctx contains the security context information being provided by
+ *     the user-level policy update program (e.g., setkey).
+ *     @sk refers to the sock from which to derive the security context.
+ *     Allocate a security structure to the xp->security field; the security
+ *     field is initialized to NULL when the xfrm_policy is allocated. Only
+ *     one of sec_ctx or sock can be specified.
+ *     Return 0 if operation was successful (memory to allocate, legal context)
+ * @xfrm_policy_clone_security:
+ *     @old contains an existing xfrm_policy in the SPD.
+ *     @new contains a new xfrm_policy being cloned from old.
+ *     Allocate a security structure to the new->security field
+ *     that contains the information from the old->security field.
+ *     Return 0 if operation was successful (memory to allocate).
+ * @xfrm_policy_free_security:
+ *     @xp contains the xfrm_policy
+ *     Deallocate xp->security.
+ * @xfrm_policy_delete_security:
+ *     @xp contains the xfrm_policy.
+ *     Authorize deletion of xp->security.
+ * @xfrm_state_alloc_security:
+ *     @x contains the xfrm_state being added to the Security Association
+ *     Database by the XFRM system.
+ *     @sec_ctx contains the security context information being provided by
+ *     the user-level SA generation program (e.g., setkey or racoon).
+ *     @polsec contains the security context information associated with a xfrm
+ *     policy rule from which to take the base context. polsec must be NULL
+ *     when sec_ctx is specified.
+ *     @secid contains the secid from which to take the mls portion of the context.
+ *     Allocate a security structure to the x->security field; the security
+ *     field is initialized to NULL when the xfrm_state is allocated. Set the
+ *     context to correspond to either sec_ctx or polsec, with the mls portion
+ *     taken from secid in the latter case.
+ *     Return 0 if operation was successful (memory to allocate, legal context).
+ * @xfrm_state_free_security:
+ *     @x contains the xfrm_state.
+ *     Deallocate x->security.
+ * @xfrm_state_delete_security:
+ *     @x contains the xfrm_state.
+ *     Authorize deletion of x->security.
+ * @xfrm_policy_lookup:
+ *     @xp contains the xfrm_policy for which the access control is being
+ *     checked.
+ *     @fl_secid contains the flow security label that is used to authorize
+ *     access to the policy xp.
+ *     @dir contains the direction of the flow (input or output).
+ *     Check permission when a flow selects a xfrm_policy for processing
+ *     XFRMs on a packet.  The hook is called when selecting either a
+ *     per-socket policy or a generic xfrm policy.
+ *     Return 0 if permission is granted.
+ * @xfrm_state_pol_flow_match:
+ *     @x contains the state to match.
+ *     @xp contains the policy to check for a match.
+ *     @fl contains the flow to check for a match.
+ *     Return 1 if there is a match.
+ * @xfrm_flow_state_match:
+ *     @fl contains the flow key to match.
+ *     @xfrm points to the xfrm_state to match.
+ *     Return 1 if there is a match.
+ * @xfrm_decode_session:
+ *     @skb points to skb to decode.
+ *     @secid points to the flow key secid to set.
+ *     @ckall says if all xfrms used should be checked for same secid.
+ *     Return 0 if ckall is zero or all xfrms used have the same secid.
+ *
+ * Security hooks affecting all Key Management operations
+ *
+ * @key_alloc:
+ *     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.
+ *     @key points to the key.
+ *     No return value.
+ * @key_permission:
+ *     See whether a specific operational right is granted to a process on a
+ *      key.
+ *     @key_ref refers to the key (key pointer + possession attribute bit).
+ *     @context points to the process to provide the context against which to
+ *       evaluate the security data on the key.
+ *     @perm describes the combination of permissions required of this key.
+ *     Return 1 if permission granted, 0 if permission denied and -ve it the
+ *      normal permissions model should be effected.
  *
  * Security hooks affecting all System V IPC operations.
  *
@@ -963,6 +1098,11 @@ struct swap_info_struct;
  *     @effective contains the effective capability set.
  *     @inheritable contains the inheritable capability set.
  *     @permitted contains the permitted capability set.
+ * @capable:
+ *     Check whether the @tsk process has the @cap capability.
+ *     @tsk contains the task_struct for the process.
+ *     @cap contains the capability <include/linux/capability.h>.
+ *     Return 0 if the capability is granted for @tsk.
  * @acct:
  *     Check permission before enabling or disabling process accounting.  If
  *     accounting is being enabled, then @file refers to the open file used to
@@ -976,11 +1116,6 @@ struct swap_info_struct;
  *     @table contains the ctl_table structure for the sysctl variable.
  *     @op contains the operation (001 = search, 002 = write, 004 = read).
  *     Return 0 if permission is granted.
- * @capable:
- *     Check whether the @tsk process has the @cap capability.
- *     @tsk contains the task_struct for the process.
- *     @cap contains the capability <include/linux/capability.h>.
- *     Return 0 if the capability is granted for @tsk.
  * @syslog:
  *     Check permission before accessing the kernel message ring or changing
  *     logging to the console.
@@ -1007,6 +1142,16 @@ struct swap_info_struct;
  *     @name contains the name of the security module being unstacked.
  *     @ops contains a pointer to the struct security_operations of the module to unstack.
  * 
+ * @secid_to_secctx:
+ *     Convert secid to security context.
+ *     @secid contains the security ID.
+ *     @secdata contains the pointer that stores the converted security context.
+ *
+ * @release_secctx:
+ *     Release the security context.
+ *     @secdata contains the security context.
+ *     @seclen contains the length of the security context.
+ *
  * This is the main security structure.
  */
 struct security_operations {
@@ -1022,9 +1167,9 @@ struct security_operations {
                            kernel_cap_t * effective,
                            kernel_cap_t * inheritable,
                            kernel_cap_t * permitted);
+       int (*capable) (struct task_struct * tsk, int cap);
        int (*acct) (struct file * file);
        int (*sysctl) (struct ctl_table * table, int op);
-       int (*capable) (struct task_struct * tsk, int cap);
        int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
        int (*quota_on) (struct dentry * dentry);
        int (*syslog) (int type);
@@ -1044,7 +1189,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);
@@ -1091,7 +1236,8 @@ struct security_operations {
        int (*inode_getxattr) (struct dentry *dentry, char *name);
        int (*inode_listxattr) (struct dentry *dentry);
        int (*inode_removexattr) (struct dentry *dentry, char *name);
-       int (*inode_getsecurity)(struct inode *inode, const char *name, void *buffer, size_t size);
+       const char *(*inode_xattr_getsuffix) (void);
+       int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
        int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
        int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
 
@@ -1124,14 +1270,18 @@ struct security_operations {
        int (*task_setpgid) (struct task_struct * p, pid_t pgid);
        int (*task_getpgid) (struct task_struct * p);
        int (*task_getsid) (struct task_struct * p);
+       void (*task_getsecid) (struct task_struct * p, u32 * secid);
        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_getioprio) (struct task_struct * p);
        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);
+                         struct siginfo * info, int sig, u32 secid);
        int (*task_wait) (struct task_struct * p);
        int (*task_prctl) (int option, unsigned long arg2,
                           unsigned long arg3, unsigned long arg4,
@@ -1170,7 +1320,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,
@@ -1182,6 +1332,8 @@ struct security_operations {
 
        int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
        int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
+       int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
+       void (*release_secctx)(char *secdata, u32 seclen);
 
 #ifdef CONFIG_SECURITY_NETWORK
        int (*unix_stream_connect) (struct socket * sock,
@@ -1189,8 +1341,8 @@ struct security_operations {
        int (*unix_may_send) (struct socket * sock, struct socket * other);
 
        int (*socket_create) (int family, int type, int protocol, int kern);
-       void (*socket_post_create) (struct socket * sock, int family,
-                                   int type, int protocol, int kern);
+       int (*socket_post_create) (struct socket * sock, int family,
+                                  int type, int protocol, int kern);
        int (*socket_bind) (struct socket * sock,
                            struct sockaddr * address, int addrlen);
        int (*socket_connect) (struct socket * sock,
@@ -1209,10 +1361,47 @@ struct security_operations {
        int (*socket_setsockopt) (struct socket * sock, int level, int optname);
        int (*socket_shutdown) (struct socket * sock, int how);
        int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
-       int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
-       int (*sk_alloc_security) (struct sock *sk, int family, int priority);
+       int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
+       int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
+       int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
        void (*sk_free_security) (struct sock *sk);
+       void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
+       void (*sk_getsecid) (struct sock *sk, u32 *secid);
+       void (*sock_graft)(struct sock* sk, struct socket *parent);
+       int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
+                                       struct request_sock *req);
+       void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
+       void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
 #endif /* CONFIG_SECURITY_NETWORK */
+
+#ifdef CONFIG_SECURITY_NETWORK_XFRM
+       int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
+                       struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk);
+       int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
+       void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
+       int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
+       int (*xfrm_state_alloc_security) (struct xfrm_state *x,
+               struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec,
+               u32 secid);
+       void (*xfrm_state_free_security) (struct xfrm_state *x);
+       int (*xfrm_state_delete_security) (struct xfrm_state *x);
+       int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
+       int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
+                       struct xfrm_policy *xp, struct flowi *fl);
+       int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm);
+       int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
+
+       /* key management security hooks */
+#ifdef CONFIG_KEYS
+       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,
+                             key_perm_t perm);
+
+#endif /* CONFIG_KEYS */
+
 };
 
 /* global variables */
@@ -1248,6 +1437,11 @@ static inline void security_capset_set (struct task_struct *target,
        security_ops->capset_set (target, effective, inheritable, permitted);
 }
 
+static inline int security_capable(struct task_struct *tsk, int cap)
+{
+       return security_ops->capable(tsk, cap);
+}
+
 static inline int security_acct (struct file *file)
 {
        return security_ops->acct (file);
@@ -1337,9 +1531,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,
@@ -1401,15 +1595,12 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
 
 static inline int security_inode_alloc (struct inode *inode)
 {
-       if (unlikely (IS_PRIVATE (inode)))
-               return 0;
+       inode->i_security = NULL;
        return security_ops->inode_alloc_security (inode);
 }
 
 static inline void security_inode_free (struct inode *inode)
 {
-       if (unlikely (IS_PRIVATE (inode)))
-               return;
        security_ops->inode_free_security (inode);
 }
 
@@ -1580,11 +1771,16 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
        return security_ops->inode_removexattr (dentry, name);
 }
 
-static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size)
+static inline const char *security_inode_xattr_getsuffix(void)
+{
+       return security_ops->inode_xattr_getsuffix();
+}
+
+static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
 {
        if (unlikely (IS_PRIVATE (inode)))
                return 0;
-       return security_ops->inode_getsecurity(inode, name, buffer, size);
+       return security_ops->inode_getsecurity(inode, name, buffer, size, err);
 }
 
 static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
@@ -1712,6 +1908,11 @@ static inline int security_task_getsid (struct task_struct *p)
        return security_ops->task_getsid (p);
 }
 
+static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
+{
+       security_ops->task_getsecid (p, secid);
+}
+
 static inline int security_task_setgroups (struct group_info *group_info)
 {
        return security_ops->task_setgroups (group_info);
@@ -1722,6 +1923,16 @@ 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_getioprio (struct task_struct *p)
+{
+       return security_ops->task_getioprio (p);
+}
+
 static inline int security_task_setrlimit (unsigned int resource,
                                           struct rlimit *new_rlim)
 {
@@ -1740,10 +1951,16 @@ 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)
+                                     struct siginfo *info, int sig,
+                                     u32 secid)
 {
-       return security_ops->task_kill (p, info, sig);
+       return security_ops->task_kill (p, info, sig, secid);
 }
 
 static inline int security_task_wait (struct task_struct *p)
@@ -1896,9 +2113,19 @@ 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);
+}
+
+static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
+{
+       return security_ops->secid_to_secctx(secid, secdata, seclen);
+}
+
+static inline void security_release_secctx(char *secdata, u32 seclen)
+{
+       return security_ops->release_secctx(secdata, seclen);
 }
 
 /* prototypes */
@@ -1955,6 +2182,11 @@ static inline void security_capset_set (struct task_struct *target,
        cap_capset_set (target, effective, inheritable, permitted);
 }
 
+static inline int security_capable(struct task_struct *tsk, int cap)
+{
+       return cap_capable(tsk, cap);
+}
+
 static inline int security_acct (struct file *file)
 {
        return 0;
@@ -2043,7 +2275,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;
 }
@@ -2222,7 +2454,12 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
        return cap_inode_removexattr(dentry, name);
 }
 
-static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size)
+static inline const char *security_inode_xattr_getsuffix (void)
+{
+       return NULL ;
+}
+
+static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
 {
        return -EOPNOTSUPP;
 }
@@ -2344,6 +2581,9 @@ static inline int security_task_getsid (struct task_struct *p)
        return 0;
 }
 
+static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
+{ }
+
 static inline int security_task_setgroups (struct group_info *group_info)
 {
        return 0;
@@ -2354,6 +2594,16 @@ 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_getioprio (struct task_struct *p)
+{
+       return 0;
+}
+
 static inline int security_task_setrlimit (unsigned int resource,
                                           struct rlimit *new_rlim)
 {
@@ -2372,8 +2622,14 @@ 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)
+                                     struct siginfo *info, int sig,
+                                     u32 secid)
 {
        return 0;
 }
@@ -2514,11 +2770,38 @@ 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, cap);
+}
+
+static inline struct dentry *securityfs_create_dir(const char *name,
+                                       struct dentry *parent)
+{
+       return ERR_PTR(-ENODEV);
+}
+
+static inline struct dentry *securityfs_create_file(const char *name,
+                                               mode_t mode,
+                                               struct dentry *parent,
+                                               void *data,
+                                               struct file_operations *fops)
+{
+       return ERR_PTR(-ENODEV);
+}
+
+static inline void securityfs_remove(struct dentry *dentry)
 {
-       return cap_netlink_recv (skb);
 }
 
+static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline void security_release_secctx(char *secdata, u32 seclen)
+{
+}
 #endif /* CONFIG_SECURITY */
 
 #ifdef CONFIG_SECURITY_NETWORK
@@ -2542,13 +2825,13 @@ static inline int security_socket_create (int family, int type,
        return security_ops->socket_create(family, type, protocol, kern);
 }
 
-static inline void security_socket_post_create(struct socket * sock, 
-                                              int family,
-                                              int type, 
-                                              int protocol, int kern)
+static inline int security_socket_post_create(struct socket * sock,
+                                             int family,
+                                             int type,
+                                             int protocol, int kern)
 {
-       security_ops->socket_post_create(sock, family, type,
-                                        protocol, kern);
+       return security_ops->socket_post_create(sock, family, type,
+                                               protocol, kern);
 }
 
 static inline int security_socket_bind(struct socket * sock, 
@@ -2628,10 +2911,15 @@ static inline int security_sock_rcv_skb (struct sock * sk,
        return security_ops->socket_sock_rcv_skb (sk, skb);
 }
 
-static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
-                                            int __user *optlen, unsigned len)
+static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
+                                                   int __user *optlen, unsigned len)
+{
+       return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
+}
+
+static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
 {
-       return security_ops->socket_getpeersec(sock, optval, optlen, len);
+       return security_ops->socket_getpeersec_dgram(sock, skb, secid);
 }
 
 static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2643,6 +2931,38 @@ static inline void security_sk_free(struct sock *sk)
 {
        return security_ops->sk_free_security(sk);
 }
+
+static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
+{
+       return security_ops->sk_clone_security(sk, newsk);
+}
+
+static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
+{
+       security_ops->sk_getsecid(sk, &fl->secid);
+}
+
+static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
+{
+       security_ops->req_classify_flow(req, fl);
+}
+
+static inline void security_sock_graft(struct sock* sk, struct socket *parent)
+{
+       security_ops->sock_graft(sk, parent);
+}
+
+static inline int security_inet_conn_request(struct sock *sk,
+                       struct sk_buff *skb, struct request_sock *req)
+{
+       return security_ops->inet_conn_request(sk, skb, req);
+}
+
+static inline void security_inet_csk_clone(struct sock *newsk,
+                       const struct request_sock *req)
+{
+       security_ops->inet_csk_clone(newsk, req);
+}
 #else  /* CONFIG_SECURITY_NETWORK */
 static inline int security_unix_stream_connect(struct socket * sock,
                                               struct socket * other, 
@@ -2663,11 +2983,12 @@ static inline int security_socket_create (int family, int type,
        return 0;
 }
 
-static inline void security_socket_post_create(struct socket * sock, 
-                                              int family,
-                                              int type, 
-                                              int protocol, int kern)
+static inline int security_socket_post_create(struct socket * sock,
+                                             int family,
+                                             int type,
+                                             int protocol, int kern)
 {
+       return 0;
 }
 
 static inline int security_socket_bind(struct socket * sock, 
@@ -2745,8 +3066,13 @@ static inline int security_sock_rcv_skb (struct sock * sk,
        return 0;
 }
 
-static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
-                                            int __user *optlen, unsigned len)
+static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
+                                                   int __user *optlen, unsigned len)
+{
+       return -ENOPROTOOPT;
+}
+
+static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
 {
        return -ENOPROTOOPT;
 }
@@ -2759,7 +3085,229 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
 static inline void security_sk_free(struct sock *sk)
 {
 }
+
+static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
+{
+}
+
+static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
+{
+}
+
+static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
+{
+}
+
+static inline void security_sock_graft(struct sock* sk, struct socket *parent)
+{
+}
+
+static inline int security_inet_conn_request(struct sock *sk,
+                       struct sk_buff *skb, struct request_sock *req)
+{
+       return 0;
+}
+
+static inline void security_inet_csk_clone(struct sock *newsk,
+                       const struct request_sock *req)
+{
+}
 #endif /* CONFIG_SECURITY_NETWORK */
 
+#ifdef CONFIG_SECURITY_NETWORK_XFRM
+static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
+}
+
+static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
+{
+       return security_ops->xfrm_policy_alloc_security(xp, NULL, sk);
+}
+
+static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
+{
+       return security_ops->xfrm_policy_clone_security(old, new);
+}
+
+static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
+{
+       security_ops->xfrm_policy_free_security(xp);
+}
+
+static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+       return security_ops->xfrm_policy_delete_security(xp);
+}
+
+static inline int security_xfrm_state_alloc(struct xfrm_state *x,
+                       struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0);
+}
+
+static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
+                               struct xfrm_sec_ctx *polsec, u32 secid)
+{
+       if (!polsec)
+               return 0;
+       return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid);
+}
+
+static inline int security_xfrm_state_delete(struct xfrm_state *x)
+{
+       return security_ops->xfrm_state_delete_security(x);
+}
+
+static inline void security_xfrm_state_free(struct xfrm_state *x)
+{
+       security_ops->xfrm_state_free_security(x);
+}
+
+static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
+{
+       return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
+}
+
+static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
+                       struct xfrm_policy *xp, struct flowi *fl)
+{
+       return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
+}
+
+static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm)
+{
+       return security_ops->xfrm_flow_state_match(fl, xfrm);
+}
+
+static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
+{
+       return security_ops->xfrm_decode_session(skb, secid, 1);
+}
+
+static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
+{
+       int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
+
+       BUG_ON(rc);
+}
+#else  /* CONFIG_SECURITY_NETWORK_XFRM */
+static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return 0;
+}
+
+static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
+{
+       return 0;
+}
+
+static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
+{
+       return 0;
+}
+
+static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
+{
+}
+
+static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+       return 0;
+}
+
+static inline int security_xfrm_state_alloc(struct xfrm_state *x,
+                                       struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return 0;
+}
+
+static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
+                                       struct xfrm_sec_ctx *polsec, u32 secid)
+{
+       return 0;
+}
+
+static inline void security_xfrm_state_free(struct xfrm_state *x)
+{
+}
+
+static inline int security_xfrm_state_delete(struct xfrm_state *x)
+{
+       return 0;
+}
+
+static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
+{
+       return 0;
+}
+
+static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
+                       struct xfrm_policy *xp, struct flowi *fl)
+{
+       return 1;
+}
+
+static inline int security_xfrm_flow_state_match(struct flowi *fl,
+                                struct xfrm_state *xfrm)
+{
+       return 1;
+}
+
+static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
+{
+       return 0;
+}
+
+static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
+{
+}
+
+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
+
+#ifdef CONFIG_KEYS
+#ifdef CONFIG_SECURITY
+static inline int security_key_alloc(struct key *key,
+                                    struct task_struct *tsk,
+                                    unsigned long flags)
+{
+       return security_ops->key_alloc(key, tsk, flags);
+}
+
+static inline void security_key_free(struct key *key)
+{
+       security_ops->key_free(key);
+}
+
+static inline int security_key_permission(key_ref_t key_ref,
+                                         struct task_struct *context,
+                                         key_perm_t perm)
+{
+       return security_ops->key_permission(key_ref, context, perm);
+}
+
+#else
+
+static inline int security_key_alloc(struct key *key,
+                                    struct task_struct *tsk,
+                                    unsigned long flags)
+{
+       return 0;
+}
+
+static inline void security_key_free(struct key *key)
+{
+}
+
+static inline int security_key_permission(key_ref_t key_ref,
+                                         struct task_struct *context,
+                                         key_perm_t perm)
+{
+       return 0;
+}
+
+#endif
+#endif /* CONFIG_KEYS */
+
 #endif /* ! __LINUX_SECURITY_H */