SUNRPC: pass buffer size to svc_sock_names()
[safe/jmp/linux-2.6] / include / linux / security.h
index 68be112..d5fd616 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/sched.h>
 #include <linux/key.h>
 #include <linux/xfrm.h>
+#include <linux/gfp.h>
 #include <net/flow.h>
 
 /* Maximum number of letters for an LSM name string */
@@ -48,7 +49,8 @@ struct audit_krule;
  * 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, int audit);
+extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
+                      int cap, int audit);
 extern int cap_settime(struct timespec *ts, struct timezone *tz);
 extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
 extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -57,8 +59,7 @@ extern int cap_capset(struct cred *new, const struct cred *old,
                      const kernel_cap_t *effective,
                      const kernel_cap_t *inheritable,
                      const kernel_cap_t *permitted);
-extern int cap_bprm_set_security(struct linux_binprm *bprm);
-extern int cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
+extern int cap_bprm_set_creds(struct linux_binprm *bprm);
 extern int cap_bprm_secureexec(struct linux_binprm *bprm);
 extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
                              const void *value, size_t size, int flags);
@@ -110,7 +111,7 @@ extern unsigned long mmap_min_addr;
 struct sched_param;
 struct request_sock;
 
-/* bprm_apply_creds unsafe reasons */
+/* bprm->unsafe reasons */
 #define LSM_UNSAFE_SHARE       1
 #define LSM_UNSAFE_PTRACE      2
 #define LSM_UNSAFE_PTRACE_CAP  4
@@ -154,36 +155,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *
  * Security hooks for program execution operations.
  *
- * @bprm_alloc_security:
- *     Allocate and attach a security structure to the @bprm->security field.
- *     The security field is initialized to NULL when the bprm structure is
- *     allocated.
- *     @bprm contains the linux_binprm structure to be modified.
- *     Return 0 if operation was successful.
- * @bprm_free_security:
- *     @bprm contains the linux_binprm structure to be modified.
- *     Deallocate and clear the @bprm->security field.
- * @bprm_apply_creds:
- *     Compute and set the security attributes of a process being transformed
- *     by an execve operation based on the old attributes (current->security)
- *     and the information saved in @bprm->security by the set_security hook.
- *     Since this function may return an error, in which case the process will
- *      be killed.  However, it can leave the security attributes of the
- *     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:
+ * @bprm_set_creds:
  *     Save security information in the bprm->security field, typically based
  *     on information about the bprm->file, for later use by the apply_creds
  *     hook.  This hook may also optionally check permissions (e.g. for
@@ -196,15 +168,30 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @bprm contains the linux_binprm structure.
  *     Return 0 if the hook is successful and permission is granted.
  * @bprm_check_security:
- *     This hook mediates the point when a search for a binary handler will
- *     begin.  It allows a check the @bprm->security value which is set in
- *     the preceding set_security call.  The primary difference from
- *     set_security is that the argv list and envp list are reliably
- *     available in @bprm.  This hook may be called multiple times
- *     during a single execve; and in each pass set_security is called
- *     first.
+ *     This hook mediates the point when a search for a binary handler will
+ *     begin.  It allows a check the @bprm->security value which is set in the
+ *     preceding set_creds call.  The primary difference from set_creds is
+ *     that the argv list and envp list are reliably available in @bprm.  This
+ *     hook may be called multiple times during a single execve; and in each
+ *     pass set_creds is called first.
  *     @bprm contains the linux_binprm structure.
  *     Return 0 if the hook is successful and permission is granted.
+ * @bprm_committing_creds:
+ *     Prepare to install the new security attributes of a process being
+ *     transformed by an execve operation, based on the old credentials
+ *     pointed to by @current->cred and the information set in @bprm->cred by
+ *     the bprm_set_creds hook.  @bprm points to the linux_binprm structure.
+ *     This hook is a good place to perform state changes on the process such
+ *     as closing open file descriptors to which access will no longer be
+ *     granted when the attributes are changed.  This is called immediately
+ *     before commit_creds().
+ * @bprm_committed_creds:
+ *     Tidy up after the installation of the new security attributes of a
+ *     process being transformed by an execve operation.  The new credentials
+ *     have, by this point, been set to @current->cred.  @bprm points to the
+ *     linux_binprm structure.  This hook is a good place to perform state
+ *     changes on the process such as clearing out non-inheritable signal
+ *     state.  This is called immediately after commit_creds().
  * @bprm_secureexec:
  *     Return a boolean value (0 or 1) indicating whether a "secure exec"
  *     is required.  The flag is passed in the auxiliary table
@@ -350,17 +337,37 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @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.
+ * @path_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.
+ *     @new_dir contains the path 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_unlink:
  *     Check the permission to remove a hard link to a file.
  *     @dir contains the inode structure of parent directory of the file.
  *     @dentry contains the dentry structure for file to be unlinked.
  *     Return 0 if permission is granted.
+ * @path_unlink:
+ *     Check the permission to remove a hard link to a file.
+ *     @dir contains the path structure of parent directory of the file.
+ *     @dentry contains the dentry structure for file to be unlinked.
+ *     Return 0 if permission is granted.
  * @inode_symlink:
  *     Check the permission to create a symbolic link to a file.
  *     @dir contains the inode structure of parent directory of the symbolic link.
  *     @dentry contains the dentry structure of the symbolic link.
  *     @old_name contains the pathname of file.
  *     Return 0 if permission is granted.
+ * @path_symlink:
+ *     Check the permission to create a symbolic link to a file.
+ *     @dir contains the path structure of parent directory of
+ *     the symbolic link.
+ *     @dentry contains the dentry structure of the symbolic link.
+ *     @old_name contains the pathname of file.
+ *     Return 0 if permission is granted.
  * @inode_mkdir:
  *     Check permissions to create a new directory in the existing directory
  *     associated with inode strcture @dir.
@@ -368,11 +375,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @dentry contains the dentry structure of new directory.
  *     @mode contains the mode of new directory.
  *     Return 0 if permission is granted.
+ * @path_mkdir:
+ *     Check permissions to create a new directory in the existing directory
+ *     associated with path strcture @path.
+ *     @dir containst the path structure of parent of the directory
+ *     to be created.
+ *     @dentry contains the dentry structure of new directory.
+ *     @mode contains the mode of new directory.
+ *     Return 0 if permission is granted.
  * @inode_rmdir:
  *     Check the permission to remove a directory.
  *     @dir contains the inode structure of parent of the directory to be removed.
  *     @dentry contains the dentry structure of directory to be removed.
  *     Return 0 if permission is granted.
+ * @path_rmdir:
+ *     Check the permission to remove a directory.
+ *     @dir contains the path structure of parent of the directory to be
+ *     removed.
+ *     @dentry contains the dentry structure of directory to be removed.
+ *     Return 0 if permission is granted.
  * @inode_mknod:
  *     Check permissions when creating a special file (or a socket or a fifo
  *     file created via the mknod system call).  Note that if mknod operation
@@ -383,6 +404,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @mode contains the mode of the new file.
  *     @dev contains the device number.
  *     Return 0 if permission is granted.
+ * @path_mknod:
+ *     Check permissions when creating a file. Note that this hook is called
+ *     even if mknod operation is being done for a regular file.
+ *     @dir contains the path structure of parent of the new file.
+ *     @dentry contains the dentry structure of the new file.
+ *     @mode contains the mode of the new file.
+ *     @dev contains the undecoded device number. Use new_decode_dev() to get
+ *     the decoded device number.
+ *     Return 0 if permission is granted.
  * @inode_rename:
  *     Check for permission to rename a file or directory.
  *     @old_dir contains the inode structure for parent of the old link.
@@ -390,6 +420,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @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.
+ * @path_rename:
+ *     Check for permission to rename a file or directory.
+ *     @old_dir contains the path structure for parent of the old link.
+ *     @old_dentry contains the dentry structure of the old link.
+ *     @new_dir contains the path structure for parent of the new link.
+ *     @new_dentry contains the dentry structure of the new link.
+ *     Return 0 if permission is granted.
  * @inode_readlink:
  *     Check the permission to read the symbolic link.
  *     @dentry contains the dentry structure for the file link.
@@ -418,6 +455,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @dentry contains the dentry structure for the file.
  *     @attr is the iattr structure containing the new file attributes.
  *     Return 0 if permission is granted.
+ * @path_truncate:
+ *     Check permission before truncating a file.
+ *     @path contains the path structure for the file.
+ *     @length is the new length of the file.
+ *     @time_attrs is the flags passed to do_truncate().
+ *     Return 0 if permission is granted.
  * @inode_getattr:
  *     Check permission before obtaining file attributes.
  *     @mnt is the vfsmount where the dentry was looked up
@@ -602,6 +645,19 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @new points to the new credentials.
  *     @old points to the original credentials.
  *     Install a new set of credentials.
+ * @kernel_act_as:
+ *     Set the credentials for a kernel service to act as (subjective context).
+ *     @new points to the credentials to be modified.
+ *     @secid specifies the security ID to be set
+ *     The current task must be the one that nominated @secid.
+ *     Return 0 if successful.
+ * @kernel_create_files_as:
+ *     Set the file creation context in a set of credentials to be the same as
+ *     the objective context of the specified inode.
+ *     @new points to the credentials to be modified.
+ *     @inode points to the inode to use as a reference.
+ *     The current task must be the one that nominated @inode.
+ *     Return 0 if successful.
  * @task_setuid:
  *     Check permission before setting one or more of the user identity
  *     attributes of the current process.  The @flags parameter indicates
@@ -825,11 +881,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @sock contains the listening socket structure.
  *     @newsock contains the newly created server socket for connection.
  *     Return 0 if permission is granted.
- * @socket_post_accept:
- *     This hook allows a security module to copy security
- *     information into the newly created socket's inode.
- *     @sock contains the listening socket structure.
- *     @newsock contains the newly created server socket for connection.
  * @socket_sendmsg:
  *     Check permission before transmitting a message to another socket.
  *     @sock contains the socket structure.
@@ -1197,9 +1248,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @permitted contains the permitted capability set.
  *     Return 0 and update @new if permission is granted.
  * @capable:
- *     Check whether the @tsk process has the @cap capability.
+ *     Check whether the @tsk process has the @cap capability in the indicated
+ *     credentials.
  *     @tsk contains the task_struct for the process.
+ *     @cred contains the credentials to use.
  *     @cap contains the capability <include/linux/capability.h>.
+ *     @audit: Whether to write an audit message or not
  *     Return 0 if the capability is granted for @tsk.
  * @acct:
  *     Check permission before enabling or disabling process accounting.  If
@@ -1292,7 +1346,8 @@ struct security_operations {
                       const kernel_cap_t *effective,
                       const kernel_cap_t *inheritable,
                       const kernel_cap_t *permitted);
-       int (*capable) (struct task_struct *tsk, int cap, int audit);
+       int (*capable) (struct task_struct *tsk, const struct cred *cred,
+                       int cap, int audit);
        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);
@@ -1301,18 +1356,16 @@ struct security_operations {
        int (*settime) (struct timespec *ts, struct timezone *tz);
        int (*vm_enough_memory) (struct mm_struct *mm, long pages);
 
-       int (*bprm_alloc_security) (struct linux_binprm *bprm);
-       void (*bprm_free_security) (struct linux_binprm *bprm);
-       int (*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_set_creds) (struct linux_binprm *bprm);
        int (*bprm_check_security) (struct linux_binprm *bprm);
        int (*bprm_secureexec) (struct linux_binprm *bprm);
+       void (*bprm_committing_creds) (struct linux_binprm *bprm);
+       void (*bprm_committed_creds) (struct linux_binprm *bprm);
 
        int (*sb_alloc_security) (struct super_block *sb);
        void (*sb_free_security) (struct super_block *sb);
        int (*sb_copy_data) (char *orig, char *copy);
-       int (*sb_kern_mount) (struct super_block *sb, void *data);
+       int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
        int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
        int (*sb_statfs) (struct dentry *dentry);
        int (*sb_mount) (char *dev_name, struct path *path,
@@ -1335,6 +1388,22 @@ struct security_operations {
                                   struct super_block *newsb);
        int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
 
+#ifdef CONFIG_SECURITY_PATH
+       int (*path_unlink) (struct path *dir, struct dentry *dentry);
+       int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode);
+       int (*path_rmdir) (struct path *dir, struct dentry *dentry);
+       int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
+                          unsigned int dev);
+       int (*path_truncate) (struct path *path, loff_t length,
+                             unsigned int time_attrs);
+       int (*path_symlink) (struct path *dir, struct dentry *dentry,
+                            const char *old_name);
+       int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
+                         struct dentry *new_dentry);
+       int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
+                           struct path *new_dir, struct dentry *new_dentry);
+#endif
+
        int (*inode_alloc_security) (struct inode *inode);
        void (*inode_free_security) (struct inode *inode);
        int (*inode_init_security) (struct inode *inode, struct inode *dir,
@@ -1398,6 +1467,8 @@ struct security_operations {
        int (*cred_prepare)(struct cred *new, const struct cred *old,
                            gfp_t gfp);
        void (*cred_commit)(struct cred *new, const struct cred *old);
+       int (*kernel_act_as)(struct cred *new, u32 secid);
+       int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
        int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
        int (*task_fix_setuid) (struct cred *new, const struct cred *old,
                                int flags);
@@ -1479,8 +1550,6 @@ struct security_operations {
                               struct sockaddr *address, int addrlen);
        int (*socket_listen) (struct socket *sock, int backlog);
        int (*socket_accept) (struct socket *sock, struct socket *newsock);
-       void (*socket_post_accept) (struct socket *sock,
-                                   struct socket *newsock);
        int (*socket_sendmsg) (struct socket *sock,
                               struct msghdr *msg, int size);
        int (*socket_recvmsg) (struct socket *sock,
@@ -1558,8 +1627,9 @@ int security_capset(struct cred *new, const struct cred *old,
                    const kernel_cap_t *effective,
                    const kernel_cap_t *inheritable,
                    const kernel_cap_t *permitted);
-int security_capable(struct task_struct *tsk, int cap);
-int security_capable_noaudit(struct task_struct *tsk, int cap);
+int security_capable(int cap);
+int security_real_capable(struct task_struct *tsk, int cap);
+int security_real_capable_noaudit(struct task_struct *tsk, int cap);
 int security_acct(struct file *file);
 int security_sysctl(struct ctl_table *table, int op);
 int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1569,17 +1639,15 @@ int security_settime(struct timespec *ts, struct timezone *tz);
 int security_vm_enough_memory(long pages);
 int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
 int security_vm_enough_memory_kern(long pages);
-int security_bprm_alloc(struct linux_binprm *bprm);
-void security_bprm_free(struct linux_binprm *bprm);
-int security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
-void security_bprm_post_apply_creds(struct linux_binprm *bprm);
-int security_bprm_set(struct linux_binprm *bprm);
+int security_bprm_set_creds(struct linux_binprm *bprm);
 int security_bprm_check(struct linux_binprm *bprm);
+void security_bprm_committing_creds(struct linux_binprm *bprm);
+void security_bprm_committed_creds(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(char *orig, char *copy);
-int security_sb_kern_mount(struct super_block *sb, void *data);
+int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
 int security_sb_show_options(struct seq_file *m, struct super_block *sb);
 int security_sb_statfs(struct dentry *dentry);
 int security_sb_mount(char *dev_name, struct path *path,
@@ -1651,6 +1719,8 @@ int security_task_create(unsigned long clone_flags);
 void security_cred_free(struct cred *cred);
 int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
 void security_commit_creds(struct cred *new, const struct cred *old);
+int security_kernel_act_as(struct cred *new, u32 secid);
+int security_kernel_create_files_as(struct cred *new, struct inode *inode);
 int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
 int security_task_fix_setuid(struct cred *new, const struct cred *old,
                             int flags);
@@ -1756,14 +1826,31 @@ static inline int security_capset(struct cred *new,
        return cap_capset(new, old, effective, inheritable, permitted);
 }
 
-static inline int security_capable(struct task_struct *tsk, int cap)
+static inline int security_capable(int cap)
+{
+       return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT);
+}
+
+static inline int security_real_capable(struct task_struct *tsk, int cap)
 {
-       return cap_capable(tsk, cap, SECURITY_CAP_AUDIT);
+       int ret;
+
+       rcu_read_lock();
+       ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT);
+       rcu_read_unlock();
+       return ret;
 }
 
-static inline int security_capable_noaudit(struct task_struct *tsk, int cap)
+static inline
+int security_real_capable_noaudit(struct task_struct *tsk, int cap)
 {
-       return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT);
+       int ret;
+
+       rcu_read_lock();
+       ret = cap_capable(tsk, __task_cred(tsk), cap,
+                              SECURITY_CAP_NOAUDIT);
+       rcu_read_unlock();
+       return ret;
 }
 
 static inline int security_acct(struct file *file)
@@ -1799,45 +1886,39 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
 
 static inline int security_vm_enough_memory(long pages)
 {
-       return cap_vm_enough_memory(current->mm, pages);
-}
-
-static inline int security_vm_enough_memory_kern(long pages)
-{
+       WARN_ON(current->mm == NULL);
        return cap_vm_enough_memory(current->mm, pages);
 }
 
 static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
 {
+       WARN_ON(mm == NULL);
        return cap_vm_enough_memory(mm, pages);
 }
 
-static inline int security_bprm_alloc(struct linux_binprm *bprm)
+static inline int security_vm_enough_memory_kern(long pages)
 {
-       return 0;
+       /* If current->mm is a kernel thread then we will pass NULL,
+          for this specific case that is fine */
+       return cap_vm_enough_memory(current->mm, pages);
 }
 
-static inline void security_bprm_free(struct linux_binprm *bprm)
-{ }
-
-static inline int security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
+static inline int security_bprm_set_creds(struct linux_binprm *bprm)
 {
-       return cap_bprm_apply_creds(bprm, unsafe);
+       return cap_bprm_set_creds(bprm);
 }
 
-static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm)
+static inline int security_bprm_check(struct linux_binprm *bprm)
 {
-       return;
+       return 0;
 }
 
-static inline int security_bprm_set(struct linux_binprm *bprm)
+static inline void security_bprm_committing_creds(struct linux_binprm *bprm)
 {
-       return cap_bprm_set_security(bprm);
 }
 
-static inline int security_bprm_check(struct linux_binprm *bprm)
+static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
 {
-       return 0;
 }
 
 static inline int security_bprm_secureexec(struct linux_binprm *bprm)
@@ -1858,7 +1939,7 @@ static inline int security_sb_copy_data(char *orig, char *copy)
        return 0;
 }
 
-static inline int security_sb_kern_mount(struct super_block *sb, void *data)
+static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
 {
        return 0;
 }
@@ -2180,6 +2261,17 @@ static inline void security_commit_creds(struct cred *new,
 {
 }
 
+static inline int security_kernel_act_as(struct cred *cred, u32 secid)
+{
+       return 0;
+}
+
+static inline int security_kernel_create_files_as(struct cred *cred,
+                                                 struct inode *inode)
+{
+       return 0;
+}
+
 static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
                                       int flags)
 {
@@ -2439,7 +2531,6 @@ int security_socket_bind(struct socket *sock, struct sockaddr *address, int addr
 int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
 int security_socket_listen(struct socket *sock, int backlog);
 int security_socket_accept(struct socket *sock, struct socket *newsock);
-void security_socket_post_accept(struct socket *sock, struct socket *newsock);
 int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
 int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
                            int size, int flags);
@@ -2518,11 +2609,6 @@ static inline int security_socket_accept(struct socket *sock,
        return 0;
 }
 
-static inline void security_socket_post_accept(struct socket *sock,
-                                              struct socket *newsock)
-{
-}
-
 static inline int security_socket_sendmsg(struct socket *sock,
                                          struct msghdr *msg, int size)
 {
@@ -2702,6 +2788,71 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
 
 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
 
+#ifdef CONFIG_SECURITY_PATH
+int security_path_unlink(struct path *dir, struct dentry *dentry);
+int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
+int security_path_rmdir(struct path *dir, struct dentry *dentry);
+int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
+                       unsigned int dev);
+int security_path_truncate(struct path *path, loff_t length,
+                          unsigned int time_attrs);
+int security_path_symlink(struct path *dir, struct dentry *dentry,
+                         const char *old_name);
+int security_path_link(struct dentry *old_dentry, struct path *new_dir,
+                      struct dentry *new_dentry);
+int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
+                        struct path *new_dir, struct dentry *new_dentry);
+#else  /* CONFIG_SECURITY_PATH */
+static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
+{
+       return 0;
+}
+
+static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
+                                     int mode)
+{
+       return 0;
+}
+
+static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
+{
+       return 0;
+}
+
+static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
+                                     int mode, unsigned int dev)
+{
+       return 0;
+}
+
+static inline int security_path_truncate(struct path *path, loff_t length,
+                                        unsigned int time_attrs)
+{
+       return 0;
+}
+
+static inline int security_path_symlink(struct path *dir, struct dentry *dentry,
+                                       const char *old_name)
+{
+       return 0;
+}
+
+static inline int security_path_link(struct dentry *old_dentry,
+                                    struct path *new_dir,
+                                    struct dentry *new_dentry)
+{
+       return 0;
+}
+
+static inline int security_path_rename(struct path *old_dir,
+                                      struct dentry *old_dentry,
+                                      struct path *new_dir,
+                                      struct dentry *new_dentry)
+{
+       return 0;
+}
+#endif /* CONFIG_SECURITY_PATH */
+
 #ifdef CONFIG_KEYS
 #ifdef CONFIG_SECURITY
 
@@ -2803,5 +2954,28 @@ static inline void securityfs_remove(struct dentry *dentry)
 
 #endif
 
+#ifdef CONFIG_SECURITY
+
+static inline char *alloc_secdata(void)
+{
+       return (char *)get_zeroed_page(GFP_KERNEL);
+}
+
+static inline void free_secdata(void *secdata)
+{
+       free_page((unsigned long)secdata);
+}
+
+#else
+
+static inline char *alloc_secdata(void)
+{
+        return (char *)1;
+}
+
+static inline void free_secdata(void *secdata)
+{ }
+#endif /* CONFIG_SECURITY */
+
 #endif /* ! __LINUX_SECURITY_H */