security: introduce kernel_module_from_file hook
[deliverable/linux.git] / include / linux / security.h
index 5b50c4e1a7c25eeada9bb6756e2ebee3ad8b7473..0f6afc657f778f2e682e7fb108e97b6788a53973 100644 (file)
@@ -694,6 +694,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     userspace to load a kernel module with the given name.
  *     @kmod_name name of the module requested by the kernel
  *     Return 0 if successful.
+ * @kernel_module_from_file:
+ *     Load a kernel module from userspace.
+ *     @file contains the file structure pointing to the file containing
+ *     the kernel module to load. If the module is being loaded from a blob,
+ *     this argument will be NULL.
+ *     Return 0 if permission is granted.
  * @task_fix_setuid:
  *     Update the module's state after setting one or more of the user
  *     identity attributes of the current process.  The @flags parameter
@@ -1411,8 +1417,8 @@ struct security_operations {
        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,
-                        char *type, unsigned long flags, void *data);
+       int (*sb_mount) (const char *dev_name, struct path *path,
+                        const char *type, unsigned long flags, void *data);
        int (*sb_umount) (struct vfsmount *mnt, int flags);
        int (*sb_pivotroot) (struct path *old_path,
                             struct path *new_path);
@@ -1508,6 +1514,7 @@ struct security_operations {
        int (*kernel_act_as)(struct cred *new, u32 secid);
        int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
        int (*kernel_module_request)(char *kmod_name);
+       int (*kernel_module_from_file)(struct file *file);
        int (*task_fix_setuid) (struct cred *new, const struct cred *old,
                                int flags);
        int (*task_setpgid) (struct task_struct *p, pid_t pgid);
@@ -1694,8 +1701,8 @@ int security_sb_remount(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,
-                     char *type, unsigned long flags, void *data);
+int security_sb_mount(const char *dev_name, struct path *path,
+                     const char *type, unsigned long flags, void *data);
 int security_sb_umount(struct vfsmount *mnt, int flags);
 int security_sb_pivotroot(struct path *old_path, struct path *new_path);
 int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
@@ -1765,6 +1772,7 @@ void security_transfer_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_kernel_module_request(char *kmod_name);
+int security_kernel_module_from_file(struct file *file);
 int security_task_fix_setuid(struct cred *new, const struct cred *old,
                             int flags);
 int security_task_setpgid(struct task_struct *p, pid_t pgid);
@@ -1964,8 +1972,8 @@ static inline int security_sb_statfs(struct dentry *dentry)
        return 0;
 }
 
-static inline int security_sb_mount(char *dev_name, struct path *path,
-                                   char *type, unsigned long flags,
+static inline int security_sb_mount(const char *dev_name, struct path *path,
+                                   const char *type, unsigned long flags,
                                    void *data)
 {
        return 0;
@@ -2278,6 +2286,11 @@ static inline int security_kernel_module_request(char *kmod_name)
        return 0;
 }
 
+static inline int security_kernel_module_from_file(struct file *file)
+{
+       return 0;
+}
+
 static inline int security_task_fix_setuid(struct cred *new,
                                           const struct cred *old,
                                           int flags)
This page took 0.028642 seconds and 5 git commands to generate.