]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - security/apparmor/lsm.c
Merge branch 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[karo-tx-linux.git] / security / apparmor / lsm.c
index fc82ac0247dc39166491863ab8057cc8800e61e9..709eacd23909acfa5438e9173085d91eb1780991 100644 (file)
@@ -406,7 +406,7 @@ static int common_file_perm(const char *op, struct file *file, u32 mask)
        struct aa_profile *profile, *fprofile = aa_cred_profile(file->f_cred);
        int error = 0;
 
-       BUG_ON(!fprofile);
+       AA_BUG(!fprofile);
 
        if (!file->f_path.mnt ||
            !path_mediated_fs(file->f_path.dentry))
@@ -505,8 +505,8 @@ static int apparmor_getprocattr(struct task_struct *task, char *name,
        return error;
 }
 
-static int apparmor_setprocattr(struct task_struct *task, char *name,
-                               void *value, size_t size)
+static int apparmor_setprocattr(const char *name, void *value,
+                               size_t size)
 {
        char *command, *largs = NULL, *args = value;
        size_t arg_size;
@@ -515,9 +515,6 @@ static int apparmor_setprocattr(struct task_struct *task, char *name,
 
        if (size == 0)
                return -EINVAL;
-       /* task can only write its own attributes */
-       if (current != task)
-               return -EACCES;
 
        /* AppArmor requires that the buffer must be null terminated atm */
        if (args[size - 1] != '\0') {
@@ -677,9 +674,9 @@ enum profile_mode aa_g_profile_mode = APPARMOR_ENFORCE;
 module_param_call(mode, param_set_mode, param_get_mode,
                  &aa_g_profile_mode, S_IRUSR | S_IWUSR);
 
-#ifdef CONFIG_SECURITY_APPARMOR_HASH
 /* whether policy verification hashing is enabled */
 bool aa_g_hash_policy = IS_ENABLED(CONFIG_SECURITY_APPARMOR_HASH_DEFAULT);
+#ifdef CONFIG_SECURITY_APPARMOR_HASH
 module_param_named(hash_policy, aa_g_hash_policy, aabool, S_IRUSR | S_IWUSR);
 #endif
 
@@ -999,7 +996,8 @@ static int __init apparmor_init(void)
                aa_free_root_ns();
                goto buffers_out;
        }
-       security_add_hooks(apparmor_hooks, ARRAY_SIZE(apparmor_hooks));
+       security_add_hooks(apparmor_hooks, ARRAY_SIZE(apparmor_hooks),
+                               "apparmor");
 
        /* Report that AppArmor successfully initialized */
        apparmor_initialized = 1;