int evm_hmac_attrs;
 
 static struct xattr_list evm_config_default_xattrnames[] = {
+       {.name = XATTR_NAME_SELINUX,
 #ifdef CONFIG_SECURITY_SELINUX
-       {.name = XATTR_NAME_SELINUX},
+        .enabled = true
 #endif
+       },
+       {.name = XATTR_NAME_SMACK,
 #ifdef CONFIG_SECURITY_SMACK
-       {.name = XATTR_NAME_SMACK},
+        .enabled = true
+#endif
+       },
+       {.name = XATTR_NAME_SMACKEXEC,
+#ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
+        .enabled = true
+#endif
+       },
+       {.name = XATTR_NAME_SMACKTRANSMUTE,
 #ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
-       {.name = XATTR_NAME_SMACKEXEC},
-       {.name = XATTR_NAME_SMACKTRANSMUTE},
-       {.name = XATTR_NAME_SMACKMMAP},
+        .enabled = true
 #endif
+       },
+       {.name = XATTR_NAME_SMACKMMAP,
+#ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
+        .enabled = true
 #endif
+       },
+       {.name = XATTR_NAME_APPARMOR,
 #ifdef CONFIG_SECURITY_APPARMOR
-       {.name = XATTR_NAME_APPARMOR},
+        .enabled = true
 #endif
+       },
+       {.name = XATTR_NAME_IMA,
 #ifdef CONFIG_IMA_APPRAISE
-       {.name = XATTR_NAME_IMA},
+        .enabled = true
 #endif
-       {.name = XATTR_NAME_CAPS},
+       },
+       {.name = XATTR_NAME_CAPS,
+        .enabled = true
+       },
 };
 
 LIST_HEAD(evm_config_xattrnames);
 
        pr_info("Initialising EVM extended attributes:\n");
        for (i = 0; i < xattrs; i++) {
-               pr_info("%s\n", evm_config_default_xattrnames[i].name);
+               pr_info("%s%s\n", evm_config_default_xattrnames[i].name,
+                       !evm_config_default_xattrnames[i].enabled ?
+                       " (disabled)" : "");
                list_add_tail(&evm_config_default_xattrnames[i].list,
                              &evm_config_xattrnames);
        }
        return evm_status;
 }
 
-static int evm_protected_xattr(const char *req_xattr_name)
+static int evm_protected_xattr_common(const char *req_xattr_name,
+                                     bool all_xattrs)
 {
        int namelen;
        int found = 0;
 
        namelen = strlen(req_xattr_name);
        list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
+               if (!all_xattrs && !xattr->enabled)
+                       continue;
+
                if ((strlen(xattr->name) == namelen)
                    && (strncmp(req_xattr_name, xattr->name, namelen) == 0)) {
                        found = 1;
        return found;
 }
 
+static int evm_protected_xattr(const char *req_xattr_name)
+{
+       return evm_protected_xattr_common(req_xattr_name, false);
+}
+
+int evm_protected_xattr_if_enabled(const char *req_xattr_name)
+{
+       return evm_protected_xattr_common(req_xattr_name, true);
+}
+
 /**
  * evm_verifyxattr - verify the integrity of the requested xattr
  * @dentry: object of the verify xattr
 
        if (rc)
                return -ERESTARTSYS;
 
-       list_for_each_entry(xattr, &evm_config_xattrnames, list)
+       list_for_each_entry(xattr, &evm_config_xattrnames, list) {
+               if (!xattr->enabled)
+                       continue;
+
                size += strlen(xattr->name) + 1;
+       }
 
        temp = kmalloc(size + 1, GFP_KERNEL);
        if (!temp) {
        }
 
        list_for_each_entry(xattr, &evm_config_xattrnames, list) {
+               if (!xattr->enabled)
+                       continue;
+
                sprintf(temp + offset, "%s\n", xattr->name);
                offset += strlen(xattr->name) + 1;
        }
                goto out;
        }
 
+       xattr->enabled = true;
        xattr->name = memdup_user_nul(buf, count);
        if (IS_ERR(xattr->name)) {
                err = PTR_ERR(xattr->name);
        list_for_each_entry(tmp, &evm_config_xattrnames, list) {
                if (strcmp(xattr->name, tmp->name) == 0) {
                        err = -EEXIST;
+                       if (!tmp->enabled) {
+                               tmp->enabled = true;
+                               err = count;
+                       }
                        mutex_unlock(&xattr_list_mutex);
                        goto out;
                }
        audit_log_end(ab);
        return count;
 out:
-       audit_log_format(ab, " res=%d", err);
+       audit_log_format(ab, " res=%d", (err < 0) ? err : 0);
        audit_log_end(ab);
        if (xattr) {
                kfree(xattr->name);