Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / security.h
index 983d7c2..1bab48f 100644 (file)
 #include <linux/signal.h>
 #include <linux/resource.h>
 #include <linux/sem.h>
-#include <linux/sysctl.h>
 #include <linux/shm.h>
 #include <linux/msg.h>
 #include <linux/sched.h>
-#include <linux/skbuff.h>
-#include <linux/netlink.h>
+#include <linux/key.h>
+
+struct ctl_table;
 
 /*
  * These functions are in security/capability.c and are used
  * as the default capabilities functions
  */
 extern int cap_capable (struct task_struct *tsk, int cap);
+extern int cap_settime (struct timespec *ts, struct timezone *tz);
 extern int cap_ptrace (struct task_struct *parent, struct task_struct *child);
 extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
 extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -53,18 +54,20 @@ extern void cap_task_reparent_to_init (struct task_struct *p);
 extern int cap_syslog (int type);
 extern int cap_vm_enough_memory (long pages);
 
-static inline int cap_netlink_send (struct sock *sk, struct sk_buff *skb)
-{
-       NETLINK_CB (skb).eff_cap = current->cap_effective;
-       return 0;
-}
-
-static inline int cap_netlink_recv (struct sk_buff *skb)
-{
-       if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
-               return -EPERM;
-       return 0;
-}
+struct msghdr;
+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);
 
 /*
  * Values used in the task_security_ops calls
@@ -113,13 +116,20 @@ struct swap_info_struct;
  *     and the information saved in @bprm->security by the set_security hook.
  *     Since this hook function (and its caller) are void, this hook can not
  *     return an error.  However, it can leave the security attributes of the
- *     process unchanged if an access failure occurs at this point. It can
- *     also perform other state changes on the process (e.g.  closing open
- *     file descriptors to which access is no longer granted if the attributes
- *     were changed). 
+ *     process unchanged if an access failure occurs at this point.
  *     bprm_apply_creds is called under task_lock.  @unsafe indicates various
  *     reasons why it may be unsafe to change security state.
  *     @bprm contains the linux_binprm structure.
+ * @bprm_post_apply_creds:
+ *     Runs after bprm_apply_creds with the task_lock dropped, so that
+ *     functions which cannot be called safely under the task_lock can
+ *     be used.  This hook is a good place to perform state changes on
+ *     the process such as closing open file descriptors to which access
+ *     is no longer granted if the attributes were changed.
+ *     Note that a security module might need to save state between
+ *     bprm_apply_creds and bprm_post_apply_creds to store the decision
+ *     on whether the process may proceed.
+ *     @bprm contains the linux_binprm structure.
  * @bprm_set_security:
  *     Save security information in the bprm->security field, typically based
  *     on information about the bprm->file, for later use by the apply_creds
@@ -247,29 +257,37 @@ struct swap_info_struct;
  *     @inode contains the inode structure.
  *     Deallocate the inode security structure and set @inode->i_security to
  *     NULL. 
+ * @inode_init_security:
+ *     Obtain the security attribute name suffix and value to set on a newly
+ *     created inode and set up the incore security field for the new inode.
+ *     This hook is called by the fs code as part of the inode creation
+ *     transaction and provides for atomic labeling of the inode, unlike
+ *     the post_create/mkdir/... hooks called by the VFS.  The hook function
+ *     is expected to allocate the name and value via kmalloc, with the caller
+ *     being responsible for calling kfree after using them.
+ *     If the security module does not use security attributes or does
+ *     not wish to put a security attribute on this particular inode,
+ *     then it should return -EOPNOTSUPP to skip this processing.
+ *     @inode contains the inode structure of the newly created inode.
+ *     @dir contains the inode structure of the parent directory.
+ *     @name will be set to the allocated name suffix (e.g. selinux).
+ *     @value will be set to the allocated attribute value.
+ *     @len will be set to the length of the value.
+ *     Returns 0 if @name and @value have been successfully set,
+ *             -EOPNOTSUPP if no security attribute is needed, or
+ *             -ENOMEM on memory allocation failure.
  * @inode_create:
  *     Check permission to create a regular file.
  *     @dir contains inode structure of the parent of the new file.
  *     @dentry contains the dentry structure for the file to be created.
  *     @mode contains the file mode of the file to be created.
  *     Return 0 if permission is granted.
- * @inode_post_create:
- *     Set the security attributes on a newly created regular file.  This hook
- *     is called after a file has been successfully created.
- *     @dir contains the inode structure of the parent directory of the new file.
- *     @dentry contains the the dentry structure for the newly created file.
- *     @mode contains the file mode.
  * @inode_link:
  *     Check permission before creating a new hard link to a file.
  *     @old_dentry contains the dentry structure for an existing link to the file.
  *     @dir contains the inode structure of the parent directory of the new link.
  *     @new_dentry contains the dentry structure for the new link.
  *     Return 0 if permission is granted.
- * @inode_post_link:
- *     Set security attributes for a new hard link to a file.
- *     @old_dentry contains the dentry structure for the existing link.
- *     @dir contains the inode structure of the parent directory of the new file.
- *     @new_dentry contains the dentry structure for the new file link.
  * @inode_unlink:
  *     Check the permission to remove a hard link to a file. 
  *     @dir contains the inode structure of parent directory of the file.
@@ -281,13 +299,6 @@ struct swap_info_struct;
  *     @dentry contains the dentry structure of the symbolic link.
  *     @old_name contains the pathname of file.
  *     Return 0 if permission is granted.
- * @inode_post_symlink:
- *     @dir contains the inode structure of the parent directory of the new link.
- *     @dentry contains the dentry structure of new symbolic link.
- *     @old_name contains the pathname of file.
- *     Set security attributes for a newly created symbolic link.  Note that
- *     @dentry->d_inode may be NULL, since the filesystem might not
- *     instantiate the dentry (e.g. NFS).
  * @inode_mkdir:
  *     Check permissions to create a new directory in the existing directory
  *     associated with inode strcture @dir. 
@@ -295,11 +306,6 @@ struct swap_info_struct;
  *     @dentry contains the dentry structure of new directory.
  *     @mode contains the mode of new directory.
  *     Return 0 if permission is granted.
- * @inode_post_mkdir:
- *     Set security attributes on a newly created directory.
- *     @dir contains the inode structure of parent of the directory to be created.
- *     @dentry contains the dentry structure of new directory.
- *     @mode contains the mode of new directory.
  * @inode_rmdir:
  *     Check the permission to remove a directory.
  *     @dir contains the inode structure of parent of the directory to be removed.
@@ -315,13 +321,6 @@ struct swap_info_struct;
  *     @mode contains the mode of the new file.
  *     @dev contains the the device number.
  *     Return 0 if permission is granted.
- * @inode_post_mknod:
- *     Set security attributes on a newly created special file (or socket or
- *     fifo file created via the mknod system call).
- *     @dir contains the inode structure of parent of the new node.
- *     @dentry contains the dentry structure of the new node.
- *     @mode contains the mode of the new node.
- *     @dev contains the the device number.
  * @inode_rename:
  *     Check for permission to rename a file or directory.
  *     @old_dir contains the inode structure for parent of the old link.
@@ -329,12 +328,6 @@ struct swap_info_struct;
  *     @new_dir contains the inode structure for parent of the new link.
  *     @new_dentry contains the dentry structure of the new link.
  *     Return 0 if permission is granted.
- * @inode_post_rename:
- *     Set security attributes on a renamed file or directory.
- *     @old_dir contains the inode structure for parent of the old link.
- *     @old_dentry contains the dentry structure of the old link.
- *     @new_dir contains the inode structure for parent of the new link.
- *     @new_dentry contains the dentry structure of the new link.
  * @inode_readlink:
  *     Check the permission to read the symbolic link.
  *     @dentry contains the dentry structure for the file link.
@@ -395,13 +388,16 @@ struct swap_info_struct;
  *     Return 0 if permission is granted.
  * @inode_getsecurity:
  *     Copy the extended attribute representation of the security label 
- *     associated with @name for @dentry into @buffer.  @buffer may be 
+ *     associated with @name for @inode into @buffer.  @buffer may be
  *     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 @dentry from the 
+ *     Set the security label associated with @name for @inode from the
  *     extended attribute value @value.  @size indicates the size of the
  *     @value in bytes.  @flags may be XATTR_CREATE, XATTR_REPLACE, or 0.
  *     Note that @name is the remainder of the attribute name after the 
@@ -409,8 +405,9 @@ struct swap_info_struct;
  *     Return 0 on success.
  * @inode_listsecurity:
  *     Copy the extended attribute names for the security labels
- *     associated with @dentry into @buffer.  @buffer may be NULL to 
- *     request the size of the buffer required.  
+ *     associated with @inode into @buffer.  The maximum size of @buffer
+ *     is specified by @buffer_size.  @buffer may be NULL to request
+ *     the size of the buffer required.
  *     Returns number of bytes used/required on success.
  *
  * Security hooks for file operations
@@ -454,13 +451,15 @@ struct swap_info_struct;
  *     Check permissions for a mmap operation.  The @file may be NULL, e.g.
  *     if mapping anonymous memory.
  *     @file contains the file structure for file to map (may be NULL).
- *     @prot contains the requested permissions.
+ *     @reqprot contains the protection requested by the application.
+ *     @prot contains the protection that will be applied by the kernel.
  *     @flags contains the operational flags.
  *     Return 0 if permission is granted.
  * @file_mprotect:
  *     Check permissions before changing memory access permissions.
  *     @vma contains the memory region to modify.
- *     @prot contains the requested permissions.
+ *     @reqprot contains the protection requested by the application.
+ *     @prot contains the protection that will be applied by the kernel.
  *     Return 0 if permission is granted.
  * @file_lock:
  *     Check permission before performing file locking operations.
@@ -485,16 +484,15 @@ struct swap_info_struct;
  *     @file contains the file structure to update.
  *     Return 0 on success.
  * @file_send_sigiotask:
- *     Check permission for the file owner @fown to send SIGIO to the process
- *     @tsk.  Note that this hook is always called from interrupt.  Note that
- *     the fown_struct, @fown, is never outside the context of a struct file,
- *     so the file structure (and associated security information) can always
- *     be obtained:
+ *     Check permission for the file owner @fown to send SIGIO or SIGURG to the
+ *     process @tsk.  Note that this hook is sometimes called from interrupt.
+ *     Note that the fown_struct, @fown, is never outside the context of a
+ *     struct file, so the file structure (and associated security information)
+ *     can always be obtained:
  *             (struct file *)((long)fown - offsetof(struct file,f_owner));
  *     @tsk contains the structure of task receiving signal.
  *     @fown contains the file owner information.
- *     @fd contains the file descriptor.
- *     @reason contains the operational flags.
+ *     @sig is the signal that will be sent.  When 0, kernel sends SIGIO.
  *     Return 0 if permission is granted.
  * @file_receive:
  *     This hook allows security modules to control the ability of a process
@@ -582,7 +580,7 @@ struct swap_info_struct;
  * @task_setrlimit:
  *     Check permission before setting the resource limits of the current
  *     process for @resource to @new_rlim.  The old resource limit values can
- *     be examined by dereferencing (current->rlim + resource).
+ *     be examined by dereferencing (current->signal->rlim + resource).
  *     @resource contains the resource whose limit is being set.
  *     @new_rlim contains the new limits for @resource.
  *     Return 0 if permission is granted.
@@ -796,6 +794,73 @@ struct swap_info_struct;
  *      which is used to copy security attributes between local stream sockets.
  * @sk_free_security:
  *     Deallocate security structure.
+ * @sk_getsid:
+ *     Retrieve the LSM-specific sid for the sock to enable caching of network
+ *     authorizations.
+ *
+ * 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).
+ *     Allocate a security structure to the xp->selector.security field.
+ *     The security field is initialized to NULL when the xfrm_policy is
+ *     allocated.
+ *     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->selector.security field
+ *     that contains the information from the old->selector.security field.
+ *     Return 0 if operation was successful (memory to allocate).
+ * @xfrm_policy_free_security:
+ *     @xp contains the xfrm_policy
+ *     Deallocate xp->selector.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).
+ *     Allocate a security structure to the x->sel.security field.  The
+ *     security field is initialized to NULL when the xfrm_state is
+ *     allocated.
+ *     Return 0 if operation was successful (memory to allocate, legal context).
+ * @xfrm_state_free_security:
+ *     @x contains the xfrm_state.
+ *     Deallocate x>sel.security.
+ * @xfrm_policy_lookup:
+ *     @xp contains the xfrm_policy for which the access control is being
+ *     checked.
+ *     @sk_sid contains the sock 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 sock 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.
+ *
+ * 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.
+ *     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.
  *
@@ -975,6 +1040,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
@@ -988,17 +1058,18 @@ 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.
  *     See the syslog(2) manual page for an explanation of the @type values.  
  *     @type contains the type of action.
  *     Return 0 if permission is granted.
+ * @settime:
+ *     Check permission to change the system time.
+ *     struct timespec and timezone are defined in include/linux/time.h
+ *     @ts contains new time
+ *     @tz contains new timezone
+ *     Return 0 if permission is granted.
  * @vm_enough_memory:
  *     Check permissions for allocating a new virtual mapping.
  *      @pages contains the number of pages.
@@ -1028,17 +1099,19 @@ struct security_operations {
                            kernel_cap_t * effective,
                            kernel_cap_t * inheritable,
                            kernel_cap_t * permitted);
-       int (*acct) (struct file * file);
-       int (*sysctl) (ctl_table * table, int op);
        int (*capable) (struct task_struct * tsk, int cap);
+       int (*acct) (struct file * file);
+       int (*sysctl) (struct ctl_table * table, int op);
        int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
-       int (*quota_on) (struct file * f);
+       int (*quota_on) (struct dentry * dentry);
        int (*syslog) (int type);
+       int (*settime) (struct timespec *ts, struct timezone *tz);
        int (*vm_enough_memory) (long pages);
 
        int (*bprm_alloc_security) (struct linux_binprm * bprm);
        void (*bprm_free_security) (struct linux_binprm * bprm);
        void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe);
+       void (*bprm_post_apply_creds) (struct linux_binprm * bprm);
        int (*bprm_set_security) (struct linux_binprm * bprm);
        int (*bprm_check_security) (struct linux_binprm * bprm);
        int (*bprm_secureexec) (struct linux_binprm * bprm);
@@ -1067,34 +1140,21 @@ struct security_operations {
 
        int (*inode_alloc_security) (struct inode *inode);      
        void (*inode_free_security) (struct inode *inode);
+       int (*inode_init_security) (struct inode *inode, struct inode *dir,
+                                   char **name, void **value, size_t *len);
        int (*inode_create) (struct inode *dir,
                             struct dentry *dentry, int mode);
-       void (*inode_post_create) (struct inode *dir,
-                                  struct dentry *dentry, int mode);
        int (*inode_link) (struct dentry *old_dentry,
                           struct inode *dir, struct dentry *new_dentry);
-       void (*inode_post_link) (struct dentry *old_dentry,
-                                struct inode *dir, struct dentry *new_dentry);
        int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
        int (*inode_symlink) (struct inode *dir,
                              struct dentry *dentry, const char *old_name);
-       void (*inode_post_symlink) (struct inode *dir,
-                                   struct dentry *dentry,
-                                   const char *old_name);
        int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
-       void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry, 
-                           int mode);
        int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
        int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
                            int mode, dev_t dev);
-       void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry,
-                                 int mode, dev_t dev);
        int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
                             struct inode *new_dir, struct dentry *new_dentry);
-       void (*inode_post_rename) (struct inode *old_dir,
-                                  struct dentry *old_dentry,
-                                  struct inode *new_dir,
-                                  struct dentry *new_dentry);
        int (*inode_readlink) (struct dentry *dentry);
        int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
        int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
@@ -1108,9 +1168,10 @@ 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 dentry *dentry, const char *name, void *buffer, size_t size);
-       int (*inode_setsecurity)(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
-       int (*inode_listsecurity)(struct dentry *dentry, char *buffer);
+       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);
 
        int (*file_permission) (struct file * file, int mask);
        int (*file_alloc_security) (struct file * file);
@@ -1118,15 +1179,17 @@ struct security_operations {
        int (*file_ioctl) (struct file * file, unsigned int cmd,
                           unsigned long arg);
        int (*file_mmap) (struct file * file,
+                         unsigned long reqprot,
                          unsigned long prot, unsigned long flags);
-       int (*file_mprotect) (struct vm_area_struct * vma, unsigned long prot);
+       int (*file_mprotect) (struct vm_area_struct * vma,
+                             unsigned long reqprot,
+                             unsigned long prot);
        int (*file_lock) (struct file * file, unsigned int cmd);
        int (*file_fcntl) (struct file * file, unsigned int cmd,
                           unsigned long arg);
        int (*file_set_fowner) (struct file * file);
        int (*file_send_sigiotask) (struct task_struct * tsk,
-                                   struct fown_struct * fown,
-                                   int fd, int reason);
+                                   struct fown_struct * fown, int sig);
        int (*file_receive) (struct file * file);
 
        int (*task_create) (unsigned long clone_flags);
@@ -1224,10 +1287,32 @@ 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 sk_buff *skb, char **secdata, u32 *seclen);
+       int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
        void (*sk_free_security) (struct sock *sk);
+       unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
 #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);
+       int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
+       void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
+       int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
+       void (*xfrm_state_free_security) (struct xfrm_state *x);
+       int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
+
+       /* key management security hooks */
+#ifdef CONFIG_KEYS
+       int (*key_alloc)(struct key *key);
+       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 */
@@ -1263,12 +1348,17 @@ 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);
 }
 
-static inline int security_sysctl(ctl_table * table, int op)
+static inline int security_sysctl(struct ctl_table *table, int op)
 {
        return security_ops->sysctl(table, op);
 }
@@ -1279,9 +1369,9 @@ static inline int security_quotactl (int cmds, int type, int id,
        return security_ops->quotactl (cmds, type, id, sb);
 }
 
-static inline int security_quota_on (struct file * file)
+static inline int security_quota_on (struct dentry * dentry)
 {
-       return security_ops->quota_on (file);
+       return security_ops->quota_on (dentry);
 }
 
 static inline int security_syslog(int type)
@@ -1289,6 +1379,12 @@ static inline int security_syslog(int type)
        return security_ops->syslog(type);
 }
 
+static inline int security_settime(struct timespec *ts, struct timezone *tz)
+{
+       return security_ops->settime(ts, tz);
+}
+
+
 static inline int security_vm_enough_memory(long pages)
 {
        return security_ops->vm_enough_memory(pages);
@@ -1306,6 +1402,10 @@ static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int uns
 {
        security_ops->bprm_apply_creds (bprm, unsafe);
 }
+static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
+{
+       security_ops->bprm_post_apply_creds (bprm);
+}
 static inline int security_bprm_set (struct linux_binprm *bprm)
 {
        return security_ops->bprm_set_security (bprm);
@@ -1413,38 +1513,41 @@ static inline void security_inode_free (struct inode *inode)
 {
        security_ops->inode_free_security (inode);
 }
+
+static inline int security_inode_init_security (struct inode *inode,
+                                               struct inode *dir,
+                                               char **name,
+                                               void **value,
+                                               size_t *len)
+{
+       if (unlikely (IS_PRIVATE (inode)))
+               return -EOPNOTSUPP;
+       return security_ops->inode_init_security (inode, dir, name, value, len);
+}
        
 static inline int security_inode_create (struct inode *dir,
                                         struct dentry *dentry,
                                         int mode)
 {
+       if (unlikely (IS_PRIVATE (dir)))
+               return 0;
        return security_ops->inode_create (dir, dentry, mode);
 }
 
-static inline void security_inode_post_create (struct inode *dir,
-                                              struct dentry *dentry,
-                                              int mode)
-{
-       security_ops->inode_post_create (dir, dentry, mode);
-}
-
 static inline int security_inode_link (struct dentry *old_dentry,
                                       struct inode *dir,
                                       struct dentry *new_dentry)
 {
+       if (unlikely (IS_PRIVATE (old_dentry->d_inode)))
+               return 0;
        return security_ops->inode_link (old_dentry, dir, new_dentry);
 }
 
-static inline void security_inode_post_link (struct dentry *old_dentry,
-                                            struct inode *dir,
-                                            struct dentry *new_dentry)
-{
-       security_ops->inode_post_link (old_dentry, dir, new_dentry);
-}
-
 static inline int security_inode_unlink (struct inode *dir,
                                         struct dentry *dentry)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_unlink (dir, dentry);
 }
 
@@ -1452,33 +1555,25 @@ static inline int security_inode_symlink (struct inode *dir,
                                          struct dentry *dentry,
                                          const char *old_name)
 {
+       if (unlikely (IS_PRIVATE (dir)))
+               return 0;
        return security_ops->inode_symlink (dir, dentry, old_name);
 }
 
-static inline void security_inode_post_symlink (struct inode *dir,
-                                               struct dentry *dentry,
-                                               const char *old_name)
-{
-       security_ops->inode_post_symlink (dir, dentry, old_name);
-}
-
 static inline int security_inode_mkdir (struct inode *dir,
                                        struct dentry *dentry,
                                        int mode)
 {
+       if (unlikely (IS_PRIVATE (dir)))
+               return 0;
        return security_ops->inode_mkdir (dir, dentry, mode);
 }
 
-static inline void security_inode_post_mkdir (struct inode *dir,
-                                             struct dentry *dentry,
-                                             int mode)
-{
-       security_ops->inode_post_mkdir (dir, dentry, mode);
-}
-
 static inline int security_inode_rmdir (struct inode *dir,
                                        struct dentry *dentry)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_rmdir (dir, dentry);
 }
 
@@ -1486,108 +1581,130 @@ static inline int security_inode_mknod (struct inode *dir,
                                        struct dentry *dentry,
                                        int mode, dev_t dev)
 {
+       if (unlikely (IS_PRIVATE (dir)))
+               return 0;
        return security_ops->inode_mknod (dir, dentry, mode, dev);
 }
 
-static inline void security_inode_post_mknod (struct inode *dir,
-                                             struct dentry *dentry,
-                                             int mode, dev_t dev)
-{
-       security_ops->inode_post_mknod (dir, dentry, mode, dev);
-}
-
 static inline int security_inode_rename (struct inode *old_dir,
                                         struct dentry *old_dentry,
                                         struct inode *new_dir,
                                         struct dentry *new_dentry)
 {
+        if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
+            (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
+               return 0;
        return security_ops->inode_rename (old_dir, old_dentry,
                                           new_dir, new_dentry);
 }
 
-static inline void security_inode_post_rename (struct inode *old_dir,
-                                              struct dentry *old_dentry,
-                                              struct inode *new_dir,
-                                              struct dentry *new_dentry)
-{
-       security_ops->inode_post_rename (old_dir, old_dentry,
-                                               new_dir, new_dentry);
-}
-
 static inline int security_inode_readlink (struct dentry *dentry)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_readlink (dentry);
 }
 
 static inline int security_inode_follow_link (struct dentry *dentry,
                                              struct nameidata *nd)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_follow_link (dentry, nd);
 }
 
 static inline int security_inode_permission (struct inode *inode, int mask,
                                             struct nameidata *nd)
 {
+       if (unlikely (IS_PRIVATE (inode)))
+               return 0;
        return security_ops->inode_permission (inode, mask, nd);
 }
 
 static inline int security_inode_setattr (struct dentry *dentry,
                                          struct iattr *attr)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_setattr (dentry, attr);
 }
 
 static inline int security_inode_getattr (struct vfsmount *mnt,
                                          struct dentry *dentry)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_getattr (mnt, dentry);
 }
 
 static inline void security_inode_delete (struct inode *inode)
 {
+       if (unlikely (IS_PRIVATE (inode)))
+               return;
        security_ops->inode_delete (inode);
 }
 
 static inline int security_inode_setxattr (struct dentry *dentry, char *name,
                                           void *value, size_t size, int flags)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_setxattr (dentry, name, value, size, flags);
 }
 
 static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
                                                void *value, size_t size, int flags)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return;
        security_ops->inode_post_setxattr (dentry, name, value, size, flags);
 }
 
 static inline int security_inode_getxattr (struct dentry *dentry, char *name)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_getxattr (dentry, name);
 }
 
 static inline int security_inode_listxattr (struct dentry *dentry)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_listxattr (dentry);
 }
 
 static inline int security_inode_removexattr (struct dentry *dentry, char *name)
 {
+       if (unlikely (IS_PRIVATE (dentry->d_inode)))
+               return 0;
        return security_ops->inode_removexattr (dentry, name);
 }
 
-static inline int security_inode_getsecurity(struct dentry *dentry, const char *name, void *buffer, size_t size)
+static inline const char *security_inode_xattr_getsuffix(void)
 {
-       return security_ops->inode_getsecurity(dentry, name, buffer, size);
+       return security_ops->inode_xattr_getsuffix();
 }
 
-static inline int security_inode_setsecurity(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) 
+static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
 {
-       return security_ops->inode_setsecurity(dentry, name, value, size, flags);
+       if (unlikely (IS_PRIVATE (inode)))
+               return 0;
+       return security_ops->inode_getsecurity(inode, name, buffer, size, err);
 }
 
-static inline int security_inode_listsecurity(struct dentry *dentry, char *buffer)
+static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
 {
-       return security_ops->inode_listsecurity(dentry, buffer);
+       if (unlikely (IS_PRIVATE (inode)))
+               return 0;
+       return security_ops->inode_setsecurity(inode, name, value, size, flags);
+}
+
+static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
+{
+       if (unlikely (IS_PRIVATE (inode)))
+               return 0;
+       return security_ops->inode_listsecurity(inode, buffer, buffer_size);
 }
 
 static inline int security_file_permission (struct file *file, int mask)
@@ -1611,16 +1728,18 @@ static inline int security_file_ioctl (struct file *file, unsigned int cmd,
        return security_ops->file_ioctl (file, cmd, arg);
 }
 
-static inline int security_file_mmap (struct file *file, unsigned long prot,
+static inline int security_file_mmap (struct file *file, unsigned long reqprot,
+                                     unsigned long prot,
                                      unsigned long flags)
 {
-       return security_ops->file_mmap (file, prot, flags);
+       return security_ops->file_mmap (file, reqprot, prot, flags);
 }
 
 static inline int security_file_mprotect (struct vm_area_struct *vma,
+                                         unsigned long reqprot,
                                          unsigned long prot)
 {
-       return security_ops->file_mprotect (vma, prot);
+       return security_ops->file_mprotect (vma, reqprot, prot);
 }
 
 static inline int security_file_lock (struct file *file, unsigned int cmd)
@@ -1641,9 +1760,9 @@ static inline int security_file_set_fowner (struct file *file)
 
 static inline int security_file_send_sigiotask (struct task_struct *tsk,
                                                struct fown_struct *fown,
-                                               int fd, int reason)
+                                               int sig)
 {
-       return security_ops->file_send_sigiotask (tsk, fown, fd, reason);
+       return security_ops->file_send_sigiotask (tsk, fown, sig);
 }
 
 static inline int security_file_receive (struct file *file)
@@ -1863,6 +1982,8 @@ static inline int security_sem_semop (struct sem_array * sma,
 
 static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
 {
+       if (unlikely (inode && IS_PRIVATE (inode)))
+               return;
        security_ops->d_instantiate (dentry, inode);
 }
 
@@ -1887,11 +2008,16 @@ static inline int security_netlink_recv(struct sk_buff * skb)
 }
 
 /* prototypes */
-extern int security_scaffolding_startup        (void);
+extern int security_init       (void);
 extern int register_security   (struct security_operations *ops);
 extern int unregister_security (struct security_operations *ops);
 extern int mod_reg_security    (const char *name, struct security_operations *ops);
 extern int mod_unreg_security  (const char *name, struct security_operations *ops);
+extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
+                                            struct dentry *parent, void *data,
+                                            struct file_operations *fops);
+extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
+extern void securityfs_remove(struct dentry *dentry);
 
 
 #else /* CONFIG_SECURITY */
@@ -1901,7 +2027,7 @@ extern int mod_unreg_security     (const char *name, struct security_operations *ops
  * are just stubbed out, but a few must call the proper capable code.
  */
 
-static inline int security_scaffolding_startup (void)
+static inline int security_init(void)
 {
        return 0;
 }
@@ -1935,12 +2061,17 @@ 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;
 }
 
-static inline int security_sysctl(ctl_table * table, int op)
+static inline int security_sysctl(struct ctl_table *table, int op)
 {
        return 0;
 }
@@ -1951,7 +2082,7 @@ static inline int security_quotactl (int cmds, int type, int id,
        return 0;
 }
 
-static inline int security_quota_on (struct file * file)
+static inline int security_quota_on (struct dentry * dentry)
 {
        return 0;
 }
@@ -1961,6 +2092,11 @@ static inline int security_syslog(int type)
        return cap_syslog(type);
 }
 
+static inline int security_settime(struct timespec *ts, struct timezone *tz)
+{
+       return cap_settime(ts, tz);
+}
+
 static inline int security_vm_enough_memory(long pages)
 {
        return cap_vm_enough_memory(pages);
@@ -1979,6 +2115,11 @@ static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int uns
        cap_bprm_apply_creds (bprm, unsafe);
 }
 
+static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
+{
+       return;
+}
+
 static inline int security_bprm_set (struct linux_binprm *bprm)
 {
        return cap_bprm_set_security (bprm);
@@ -2070,6 +2211,15 @@ static inline int security_inode_alloc (struct inode *inode)
 
 static inline void security_inode_free (struct inode *inode)
 { }
+
+static inline int security_inode_init_security (struct inode *inode,
+                                               struct inode *dir,
+                                               char **name,
+                                               void **value,
+                                               size_t *len)
+{
+       return -EOPNOTSUPP;
+}
        
 static inline int security_inode_create (struct inode *dir,
                                         struct dentry *dentry,
@@ -2078,11 +2228,6 @@ static inline int security_inode_create (struct inode *dir,
        return 0;
 }
 
-static inline void security_inode_post_create (struct inode *dir,
-                                              struct dentry *dentry,
-                                              int mode)
-{ }
-
 static inline int security_inode_link (struct dentry *old_dentry,
                                       struct inode *dir,
                                       struct dentry *new_dentry)
@@ -2090,11 +2235,6 @@ static inline int security_inode_link (struct dentry *old_dentry,
        return 0;
 }
 
-static inline void security_inode_post_link (struct dentry *old_dentry,
-                                            struct inode *dir,
-                                            struct dentry *new_dentry)
-{ }
-
 static inline int security_inode_unlink (struct inode *dir,
                                         struct dentry *dentry)
 {
@@ -2108,11 +2248,6 @@ static inline int security_inode_symlink (struct inode *dir,
        return 0;
 }
 
-static inline void security_inode_post_symlink (struct inode *dir,
-                                               struct dentry *dentry,
-                                               const char *old_name)
-{ }
-
 static inline int security_inode_mkdir (struct inode *dir,
                                        struct dentry *dentry,
                                        int mode)
@@ -2120,11 +2255,6 @@ static inline int security_inode_mkdir (struct inode *dir,
        return 0;
 }
 
-static inline void security_inode_post_mkdir (struct inode *dir,
-                                             struct dentry *dentry,
-                                             int mode)
-{ }
-
 static inline int security_inode_rmdir (struct inode *dir,
                                        struct dentry *dentry)
 {
@@ -2138,11 +2268,6 @@ static inline int security_inode_mknod (struct inode *dir,
        return 0;
 }
 
-static inline void security_inode_post_mknod (struct inode *dir,
-                                             struct dentry *dentry,
-                                             int mode, dev_t dev)
-{ }
-
 static inline int security_inode_rename (struct inode *old_dir,
                                         struct dentry *old_dentry,
                                         struct inode *new_dir,
@@ -2151,12 +2276,6 @@ static inline int security_inode_rename (struct inode *old_dir,
        return 0;
 }
 
-static inline void security_inode_post_rename (struct inode *old_dir,
-                                              struct dentry *old_dentry,
-                                              struct inode *new_dir,
-                                              struct dentry *new_dentry)
-{ }
-
 static inline int security_inode_readlink (struct dentry *dentry)
 {
        return 0;
@@ -2214,17 +2333,22 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
        return cap_inode_removexattr(dentry, name);
 }
 
-static inline int security_inode_getsecurity(struct dentry *dentry, 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;
 }
 
-static inline int security_inode_setsecurity(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) 
+static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
 {
        return -EOPNOTSUPP;
 }
 
-static inline int security_inode_listsecurity(struct dentry *dentry, char *buffer)
+static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
 {
        return 0;
 }
@@ -2248,13 +2372,15 @@ static inline int security_file_ioctl (struct file *file, unsigned int cmd,
        return 0;
 }
 
-static inline int security_file_mmap (struct file *file, unsigned long prot,
+static inline int security_file_mmap (struct file *file, unsigned long reqprot,
+                                     unsigned long prot,
                                      unsigned long flags)
 {
        return 0;
 }
 
 static inline int security_file_mprotect (struct vm_area_struct *vma,
+                                         unsigned long reqprot,
                                          unsigned long prot)
 {
        return 0;
@@ -2278,7 +2404,7 @@ static inline int security_file_set_fowner (struct file *file)
 
 static inline int security_file_send_sigiotask (struct task_struct *tsk,
                                                struct fown_struct *fown,
-                                               int fd, int reason)
+                                               int sig)
 {
        return 0;
 }
@@ -2499,11 +2625,6 @@ static inline int security_setprocattr(struct task_struct *p, char *name, void *
        return -EINVAL;
 }
 
-/*
- * The netlink capability defaults need to be used inline by default
- * (rather than hooking into the capability module) to reduce overhead
- * in the networking code.
- */
 static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
 {
        return cap_netlink_send (sk, skb);
@@ -2514,6 +2635,25 @@ static inline int security_netlink_recv (struct sk_buff *skb)
        return cap_netlink_recv (skb);
 }
 
+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)
+{
+}
+
 #endif /* CONFIG_SECURITY */
 
 #ifdef CONFIG_SECURITY_NETWORK
@@ -2623,13 +2763,19 @@ 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(sock, optval, optlen, len);
+       return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
 }
 
-static inline int security_sk_alloc(struct sock *sk, int family, int priority)
+static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
+                                                  u32 *seclen)
+{
+       return security_ops->socket_getpeersec_dgram(skb, secdata, seclen);
+}
+
+static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
 {
        return security_ops->sk_alloc_security(sk, family, priority);
 }
@@ -2638,6 +2784,11 @@ static inline void security_sk_free(struct sock *sk)
 {
        return security_ops->sk_free_security(sk);
 }
+
+static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
+{
+       return security_ops->sk_getsid(sk, fl, dir);
+}
 #else  /* CONFIG_SECURITY_NETWORK */
 static inline int security_unix_stream_connect(struct socket * sock,
                                               struct socket * other, 
@@ -2740,13 +2891,19 @@ 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_sk_alloc(struct sock *sk, int family, int priority)
+static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
+                                                  u32 *seclen)
+{
+       return -ENOPROTOOPT;
+}
+
+static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
 {
        return 0;
 }
@@ -2754,7 +2911,112 @@ static inline int security_sk_alloc(struct sock *sk, int family, int priority)
 static inline void security_sk_free(struct sock *sk)
 {
 }
+
+static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
+{
+       return 0;
+}
 #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);
+}
+
+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_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return security_ops->xfrm_state_alloc_security(x, sec_ctx);
+}
+
+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 sk_sid, u8 dir)
+{
+       return security_ops->xfrm_policy_lookup(xp, sk_sid, dir);
+}
+#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_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_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return 0;
+}
+
+static inline void security_xfrm_state_free(struct xfrm_state *x)
+{
+}
+
+static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
+{
+       return 0;
+}
+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
+
+#ifdef CONFIG_KEYS
+#ifdef CONFIG_SECURITY
+static inline int security_key_alloc(struct key *key)
+{
+       return security_ops->key_alloc(key);
+}
+
+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)
+{
+       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 */