HID: fix race between open() and disconnect() in usbhid
[safe/jmp/linux-2.6] / include / linux / security.h
index ff3f857..fea1f4a 100644 (file)
 #include <linux/xfrm.h>
 #include <net/flow.h>
 
-/*
- * Bounding set
- */
-extern kernel_cap_t cap_bset;
-
 extern unsigned securebits;
 
+/* Maximum number of letters for an LSM name string */
+#define SECURITY_NAME_MAX      10
+
 struct ctl_table;
+struct audit_krule;
 
 /*
  * These functions are in security/capability.c and are used
@@ -62,7 +61,6 @@ extern int cap_inode_need_killpriv(struct dentry *dentry);
 extern int cap_inode_killpriv(struct dentry *dentry);
 extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
 extern void cap_task_reparent_to_init (struct task_struct *p);
-extern int cap_task_kill(struct task_struct *p, struct siginfo *info, int sig, u32 secid);
 extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp);
 extern int cap_task_setioprio (struct task_struct *p, int ioprio);
 extern int cap_task_setnice (struct task_struct *p, int nice);
@@ -113,9 +111,41 @@ struct request_sock;
 
 #ifdef CONFIG_SECURITY
 
+struct security_mnt_opts {
+       char **mnt_opts;
+       int *mnt_opts_flags;
+       int num_mnt_opts;
+};
+
+static inline void security_init_mnt_opts(struct security_mnt_opts *opts)
+{
+       opts->mnt_opts = NULL;
+       opts->mnt_opts_flags = NULL;
+       opts->num_mnt_opts = 0;
+}
+
+static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
+{
+       int i;
+       if (opts->mnt_opts)
+               for(i = 0; i < opts->num_mnt_opts; i++)
+                       kfree(opts->mnt_opts[i]);
+       kfree(opts->mnt_opts);
+       opts->mnt_opts = NULL;
+       kfree(opts->mnt_opts_flags);
+       opts->mnt_opts_flags = NULL;
+       opts->num_mnt_opts = 0;
+}
+
 /**
  * struct security_operations - main security structure
  *
+ * Security module identifier.
+ *
+ * @name:
+ *     A string that acts as a unique identifeir for the LSM with max number
+ *     of characters = SECURITY_NAME_MAX.
+ *
  * Security hooks for program execution operations.
  *
  * @bprm_alloc_security:
@@ -243,9 +273,6 @@ struct request_sock;
  *     @mnt contains the mounted file system.
  *     @flags contains the new filesystem flags.
  *     @data contains the filesystem-specific data.
- * @sb_post_mountroot:
- *     Update the security module's state when the root filesystem is mounted.
- *     This hook is only called if the mount was successful.
  * @sb_post_addmount:
  *     Update the security module's state when a filesystem is mounted.
  *     This hook is called any time a mount is successfully grafetd to
@@ -261,6 +288,22 @@ struct request_sock;
  *     Update module state after a successful pivot.
  *     @old_nd contains the nameidata structure for the old root.
  *      @new_nd contains the nameidata structure for the new root.
+ * @sb_get_mnt_opts:
+ *     Get the security relevant mount options used for a superblock
+ *     @sb the superblock to get security mount options from
+ *     @opts binary data structure containing all lsm mount data
+ * @sb_set_mnt_opts:
+ *     Set the security relevant mount options used for a superblock
+ *     @sb the superblock to set security mount options for
+ *     @opts binary data structure containing all lsm mount data
+ * @sb_clone_mnt_opts:
+ *     Copy all security options from a given superblock to another
+ *     @oldsb old superblock which contain information to clone
+ *     @newsb new superblock which needs filled in
+ * @sb_parse_opts_str:
+ *     Parse a string of security data filling in the opts structure
+ *     @options string containing all mount options known by the LSM
+ *     @opts binary data structure usable by the LSM
  *
  * Security hooks for inode operations.
  *
@@ -404,15 +447,12 @@ struct request_sock;
  *     identified by @name for @dentry.
  *     Return 0 if permission is granted.
  * @inode_getsecurity:
- *     Copy the extended attribute representation of the security label 
- *     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.
+ *     Retrieve a copy of the extended attribute representation of the
+ *     security label associated with @name for @inode via @buffer.  Note that
+ *     @name is the remainder of the attribute name after the security prefix
+ *     has been removed. @alloc is used to specify of the call should return a
+ *     value via the buffer or just the value length Return size of buffer on
+ *     success.
  * @inode_setsecurity:
  *     Set the security label associated with @name for @inode from the
  *     extended attribute value @value.  @size indicates the size of the
@@ -438,6 +478,11 @@ struct request_sock;
  *     @dentry is the dentry being changed.
  *     Return 0 on success.  If error is returned, then the operation
  *     causing setuid bit removal is failed.
+ * @inode_getsecid:
+ *     Get the secid associated with the node.
+ *     @inode contains a pointer to the inode.
+ *     @secid contains a pointer to the location where result will be saved.
+ *     In case of failure, @secid will be set to zero.
  *
  * Security hooks for file operations
  *
@@ -606,6 +651,8 @@ struct request_sock;
  * @task_getsecid:
  *     Retrieve the security identifier of the process @p.
  *     @p contains the task_struct for the process and place is into @secid.
+ *     In case of failure, @secid will be set to zero.
+ *
  * @task_setgroups:
  *     Check permission before setting the supplementary group set of the
  *     current process.
@@ -832,9 +879,11 @@ struct request_sock;
  *     incoming sk_buff @skb has been associated with a particular socket, @sk.
  *     @sk contains the sock (not socket) associated with the incoming sk_buff.
  *     @skb contains the incoming network data.
- * @socket_getpeersec:
+ * @socket_getpeersec_stream:
  *     This hook allows the security module to provide peer socket security
- *     state to userspace via getsockopt SO_GETPEERSEC.
+ *     state for unix or connected tcp sockets to userspace via getsockopt
+ *     SO_GETPEERSEC.  For tcp sockets this can be meaningful if the
+ *     socket is associated with an ipsec SA.
  *     @sock is the local socket.
  *     @optval userspace memory where the security state is to be copied.
  *     @optlen userspace int where the module should copy the actual length
@@ -843,6 +892,17 @@ struct request_sock;
  *     by the caller.
  *     Return 0 if all is well, otherwise, typical getsockopt return
  *     values.
+ * @socket_getpeersec_dgram:
+ *     This hook allows the security module to provide peer socket security
+ *     state for udp sockets on a per-packet basis to userspace via
+ *     getsockopt SO_GETPEERSEC.  The application must first have indicated
+ *     the IP_PASSSEC option via getsockopt.  It can then retrieve the
+ *     security state returned by this hook for a packet via the SCM_SECURITY
+ *     ancillary message type.
+ *     @skb is the skbuff for the packet being queried
+ *     @secdata is a pointer to a buffer in which to copy the security data
+ *     @seclen is the maximum length for @secdata
+ *     Return 0 on success, error on failure.
  * @sk_alloc_security:
  *      Allocate and attach a security structure to the sk->sk_security field,
  *      which is used to copy security attributes between local stream sockets.
@@ -867,24 +927,24 @@ struct request_sock;
  * 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.
+ *     @ctxp is a pointer to the xfrm_sec_ctx 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->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->security field
- *     that contains the information from the old->security field.
+ *     @old_ctx contains an existing xfrm_sec_ctx.
+ *     @new_ctxp contains a new xfrm_sec_ctx being cloned from old.
+ *     Allocate a security structure in new_ctxp that contains the
+ *     information from the old_ctx structure.
  *     Return 0 if operation was successful (memory to allocate).
  * @xfrm_policy_free_security:
- *     @xp contains the xfrm_policy
+ *     @ctx contains the xfrm_sec_ctx
  *     Deallocate xp->security.
  * @xfrm_policy_delete_security:
- *     @xp contains the xfrm_policy.
+ *     @ctx contains the xfrm_sec_ctx.
  *     Authorize deletion of xp->security.
  * @xfrm_state_alloc_security:
  *     @x contains the xfrm_state being added to the Security Association
@@ -904,7 +964,7 @@ struct request_sock;
  *     @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
+ *     @ctx contains the xfrm_sec_ctx 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.
@@ -954,6 +1014,11 @@ struct request_sock;
  *     @ipcp contains the kernel IPC permission structure
  *     @flag contains the desired (requested) permission set
  *     Return 0 if permission is granted.
+ * @ipc_getsecid:
+ *     Get the secid associated with the ipc object.
+ *     @ipcp contains the kernel IPC permission structure.
+ *     @secid contains a pointer to the location where result will be saved.
+ *     In case of failure, @secid will be set to zero.
  *
  * Security hooks for individual messages held in System V IPC message queues
  * @msg_msg_alloc_security:
@@ -1170,15 +1235,52 @@ struct request_sock;
  *     Convert secid to security context.
  *     @secid contains the security ID.
  *     @secdata contains the pointer that stores the converted security context.
+ * @secctx_to_secid:
+ *      Convert security context to secid.
+ *      @secid contains the pointer to the generated security ID.
+ *      @secdata contains the security context.
  *
  * @release_secctx:
  *     Release the security context.
  *     @secdata contains the security context.
  *     @seclen contains the length of the security context.
  *
+ * Security hooks for Audit
+ *
+ * @audit_rule_init:
+ *     Allocate and initialize an LSM audit rule structure.
+ *     @field contains the required Audit action. Fields flags are defined in include/linux/audit.h
+ *     @op contains the operator the rule uses.
+ *     @rulestr contains the context where the rule will be applied to.
+ *     @lsmrule contains a pointer to receive the result.
+ *     Return 0 if @lsmrule has been successfully set,
+ *     -EINVAL in case of an invalid rule.
+ *
+ * @audit_rule_known:
+ *     Specifies whether given @rule contains any fields related to current LSM.
+ *     @rule contains the audit rule of interest.
+ *     Return 1 in case of relation found, 0 otherwise.
+ *
+ * @audit_rule_match:
+ *     Determine if given @secid matches a rule previously approved
+ *     by @audit_rule_known.
+ *     @secid contains the security id in question.
+ *     @field contains the field which relates to current LSM.
+ *     @op contains the operator that will be used for matching.
+ *     @rule points to the audit rule that will be checked against.
+ *     @actx points to the audit context associated with the check.
+ *     Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
+ *
+ * @audit_rule_free:
+ *     Deallocate the LSM audit rule structure previously allocated by
+ *     audit_rule_init.
+ *     @rule contains the allocated rule
+ *
  * This is the main security structure.
  */
 struct security_operations {
+       char name[SECURITY_NAME_MAX + 1];
+
        int (*ptrace) (struct task_struct * parent, struct task_struct * child);
        int (*capget) (struct task_struct * target,
                       kernel_cap_t * effective,
@@ -1210,8 +1312,7 @@ struct security_operations {
 
        int (*sb_alloc_security) (struct super_block * sb);
        void (*sb_free_security) (struct super_block * sb);
-       int (*sb_copy_data)(struct file_system_type *type,
-                           void *orig, void *copy);
+       int (*sb_copy_data)(char *orig, char *copy);
        int (*sb_kern_mount) (struct super_block *sb, void *data);
        int (*sb_statfs) (struct dentry *dentry);
        int (*sb_mount) (char *dev_name, struct nameidata * nd,
@@ -1222,13 +1323,19 @@ struct security_operations {
        void (*sb_umount_busy) (struct vfsmount * mnt);
        void (*sb_post_remount) (struct vfsmount * mnt,
                                 unsigned long flags, void *data);
-       void (*sb_post_mountroot) (void);
        void (*sb_post_addmount) (struct vfsmount * mnt,
                                  struct nameidata * mountpoint_nd);
        int (*sb_pivotroot) (struct nameidata * old_nd,
                             struct nameidata * new_nd);
        void (*sb_post_pivotroot) (struct nameidata * old_nd,
                                   struct nameidata * new_nd);
+       int (*sb_get_mnt_opts) (const struct super_block *sb,
+                               struct security_mnt_opts *opts);
+       int (*sb_set_mnt_opts) (struct super_block *sb,
+                               struct security_mnt_opts *opts);
+       void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
+                                  struct super_block *newsb);
+       int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
 
        int (*inode_alloc_security) (struct inode *inode);      
        void (*inode_free_security) (struct inode *inode);
@@ -1262,9 +1369,10 @@ struct security_operations {
        int (*inode_removexattr) (struct dentry *dentry, char *name);
        int (*inode_need_killpriv) (struct dentry *dentry);
        int (*inode_killpriv) (struct dentry *dentry);
-       int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
+       int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc);
        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);
+       void (*inode_getsecid)(const struct inode *inode, u32 *secid);
 
        int (*file_permission) (struct file * file, int mask);
        int (*file_alloc_security) (struct file * file);
@@ -1317,6 +1425,7 @@ struct security_operations {
        void (*task_to_inode)(struct task_struct *p, struct inode *inode);
 
        int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
+       void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid);
 
        int (*msg_msg_alloc_security) (struct msg_msg * msg);
        void (*msg_msg_free_security) (struct msg_msg * msg);
@@ -1358,6 +1467,7 @@ struct security_operations {
        int (*getprocattr)(struct task_struct *p, char *name, char **value);
        int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
        int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
+       int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid);
        void (*release_secctx)(char *secdata, u32 seclen);
 
 #ifdef CONFIG_SECURITY_NETWORK
@@ -1401,17 +1511,17 @@ struct security_operations {
 #endif /* CONFIG_SECURITY_NETWORK */
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
-       int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
+       int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
                        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_policy_delete_security) (struct xfrm_policy *xp);
+       int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
+       void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
+       int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
        int (*xfrm_state_alloc_security) (struct xfrm_state *x,
                struct xfrm_user_sec_ctx *sec_ctx,
                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_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
        int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
                        struct xfrm_policy *xp, struct flowi *fl);
        int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
@@ -1427,10 +1537,18 @@ struct security_operations {
 
 #endif /* CONFIG_KEYS */
 
+#ifdef CONFIG_AUDIT
+       int (*audit_rule_init)(u32 field, u32 op, char *rulestr, void **lsmrule);
+       int (*audit_rule_known)(struct audit_krule *krule);
+       int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule,
+                               struct audit_context *actx);
+       void (*audit_rule_free)(void *lsmrule);
+#endif /* CONFIG_AUDIT */
 };
 
 /* prototypes */
 extern int security_init       (void);
+extern int security_module_enable(struct security_operations *ops);
 extern int register_security   (struct security_operations *ops);
 extern int mod_reg_security    (const char *name, struct security_operations *ops);
 extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
@@ -1472,7 +1590,7 @@ int security_bprm_check(struct linux_binprm *bprm);
 int security_bprm_secureexec(struct linux_binprm *bprm);
 int security_sb_alloc(struct super_block *sb);
 void security_sb_free(struct super_block *sb);
-int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy);
+int security_sb_copy_data(char *orig, char *copy);
 int security_sb_kern_mount(struct super_block *sb, void *data);
 int security_sb_statfs(struct dentry *dentry);
 int security_sb_mount(char *dev_name, struct nameidata *nd,
@@ -1482,10 +1600,16 @@ int security_sb_umount(struct vfsmount *mnt, int flags);
 void security_sb_umount_close(struct vfsmount *mnt);
 void security_sb_umount_busy(struct vfsmount *mnt);
 void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
-void security_sb_post_mountroot(void);
 void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
 int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
 void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+int security_sb_get_mnt_opts(const struct super_block *sb,
+                               struct security_mnt_opts *opts);
+int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
+void security_sb_clone_mnt_opts(const struct super_block *oldsb,
+                               struct super_block *newsb);
+int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
+
 int security_inode_alloc(struct inode *inode);
 void security_inode_free(struct inode *inode);
 int security_inode_init_security(struct inode *inode, struct inode *dir,
@@ -1516,9 +1640,10 @@ int security_inode_listxattr(struct dentry *dentry);
 int security_inode_removexattr(struct dentry *dentry, char *name);
 int security_inode_need_killpriv(struct dentry *dentry);
 int security_inode_killpriv(struct dentry *dentry);
-int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
+int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
 int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
 int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
+void security_inode_getsecid(const struct inode *inode, u32 *secid);
 int security_file_permission(struct file *file, int mask);
 int security_file_alloc(struct file *file);
 void security_file_free(struct file *file);
@@ -1563,6 +1688,7 @@ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
 void security_task_reparent_to_init(struct task_struct *p);
 void security_task_to_inode(struct task_struct *p, struct inode *inode);
 int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
+void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
 int security_msg_msg_alloc(struct msg_msg *msg);
 void security_msg_msg_free(struct msg_msg *msg);
 int security_msg_queue_alloc(struct msg_queue *msq);
@@ -1590,9 +1716,20 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t
 int security_netlink_send(struct sock *sk, struct sk_buff *skb);
 int security_netlink_recv(struct sk_buff *skb, int cap);
 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
+int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid);
 void security_release_secctx(char *secdata, u32 seclen);
 
 #else /* CONFIG_SECURITY */
+struct security_mnt_opts {
+};
+
+static inline void security_init_mnt_opts(struct security_mnt_opts *opts)
+{
+}
+
+static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
+{
+}
 
 /*
  * This is the default capabilities functionality.  Most of these functions
@@ -1720,8 +1857,7 @@ static inline int security_sb_alloc (struct super_block *sb)
 static inline void security_sb_free (struct super_block *sb)
 { }
 
-static inline int security_sb_copy_data (struct file_system_type *type,
-                                        void *orig, void *copy)
+static inline int security_sb_copy_data (char *orig, char *copy)
 {
        return 0;
 }
@@ -1764,9 +1900,6 @@ static inline void security_sb_post_remount (struct vfsmount *mnt,
                                             unsigned long flags, void *data)
 { }
 
-static inline void security_sb_post_mountroot (void)
-{ }
-
 static inline void security_sb_post_addmount (struct vfsmount *mnt,
                                              struct nameidata *mountpoint_nd)
 { }
@@ -1780,6 +1913,27 @@ static inline int security_sb_pivotroot (struct nameidata *old_nd,
 static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
                                               struct nameidata *new_nd)
 { }
+static inline int security_sb_get_mnt_opts(const struct super_block *sb,
+                                          struct security_mnt_opts *opts)
+{
+       security_init_mnt_opts(opts);
+       return 0;
+}
+
+static inline int security_sb_set_mnt_opts(struct super_block *sb,
+                                          struct security_mnt_opts *opts)
+{
+       return 0;
+}
+
+static inline void security_sb_clone_mnt_opts(const struct super_block *oldsb,
+                                             struct super_block *newsb)
+{ }
+
+static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)
+{
+       return 0;
+}
 
 static inline int security_inode_alloc (struct inode *inode)
 {
@@ -1920,7 +2074,7 @@ static inline int security_inode_killpriv(struct dentry *dentry)
        return cap_inode_killpriv(dentry);
 }
 
-static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
+static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc)
 {
        return -EOPNOTSUPP;
 }
@@ -1935,6 +2089,11 @@ static inline int security_inode_listsecurity(struct inode *inode, char *buffer,
        return 0;
 }
 
+static inline void security_inode_getsecid(const struct inode *inode, u32 *secid)
+{
+       *secid = 0;
+}
+
 static inline int security_file_permission (struct file *file, int mask)
 {
        return 0;
@@ -2050,7 +2209,9 @@ static inline int security_task_getsid (struct task_struct *p)
 }
 
 static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
-{ }
+{
+       *secid = 0;
+}
 
 static inline int security_task_setgroups (struct group_info *group_info)
 {
@@ -2099,7 +2260,7 @@ static inline int security_task_kill (struct task_struct *p,
                                      struct siginfo *info, int sig,
                                      u32 secid)
 {
-       return cap_task_kill(p, info, sig, secid);
+       return 0;
 }
 
 static inline int security_task_wait (struct task_struct *p)
@@ -2129,6 +2290,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
        return 0;
 }
 
+static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
+{
+       *secid = 0;
+}
+
 static inline int security_msg_msg_alloc (struct msg_msg * msg)
 {
        return 0;
@@ -2253,7 +2419,7 @@ static inline struct dentry *securityfs_create_file(const char *name,
                                                mode_t mode,
                                                struct dentry *parent,
                                                void *data,
-                                               struct file_operations *fops)
+                                               const struct file_operations *fops)
 {
        return ERR_PTR(-ENODEV);
 }
@@ -2267,6 +2433,13 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
        return -EOPNOTSUPP;
 }
 
+static inline int security_secctx_to_secid(char *secdata,
+                                          u32 seclen,
+                                          u32 *secid)
+{
+       return -EOPNOTSUPP;
+}
+
 static inline void security_release_secctx(char *secdata, u32 seclen)
 {
 }
@@ -2468,16 +2641,16 @@ static inline void security_inet_conn_established(struct sock *sk,
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
 
-int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
-int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
-void security_xfrm_policy_free(struct xfrm_policy *xp);
-int security_xfrm_policy_delete(struct xfrm_policy *xp);
+int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx);
+int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
+void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
+int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
 int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
 int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
                                      struct xfrm_sec_ctx *polsec, u32 secid);
 int security_xfrm_state_delete(struct xfrm_state *x);
 void security_xfrm_state_free(struct xfrm_state *x);
-int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
+int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
 int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
                                       struct xfrm_policy *xp, struct flowi *fl);
 int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
@@ -2485,21 +2658,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
 
 #else  /* CONFIG_SECURITY_NETWORK_XFRM */
 
-static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx)
 {
        return 0;
 }
 
-static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
+static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
 {
        return 0;
 }
 
-static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
+static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
 {
 }
 
-static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
 {
        return 0;
 }
@@ -2525,7 +2698,7 @@ 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)
+static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
 {
        return 0;
 }
@@ -2578,5 +2751,38 @@ static inline int security_key_permission(key_ref_t key_ref,
 #endif
 #endif /* CONFIG_KEYS */
 
+#ifdef CONFIG_AUDIT
+#ifdef CONFIG_SECURITY
+int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
+int security_audit_rule_known(struct audit_krule *krule);
+int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
+                             struct audit_context *actx);
+void security_audit_rule_free(void *lsmrule);
+
+#else
+
+static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr,
+                                          void **lsmrule)
+{
+       return 0;
+}
+
+static inline int security_audit_rule_known(struct audit_krule *krule)
+{
+       return 0;
+}
+
+static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
+                                  void *lsmrule, struct audit_context *actx)
+{
+       return 0;
+}
+
+static inline void security_audit_rule_free(void *lsmrule)
+{ }
+
+#endif /* CONFIG_SECURITY */
+#endif /* CONFIG_AUDIT */
+
 #endif /* ! __LINUX_SECURITY_H */