aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/policy_unpack.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 00:43:07 -0800
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 01:18:50 -0800
commit31f75bfecd9cef7d485b1cda3c6c38cc0b4a5c6c (patch)
tree0758d1473b978e95a90655ebdba9c7e25147b68c /security/apparmor/policy_unpack.c
parentapparmor: convert change_profile to use fqname later to give better control (diff)
downloadlinux-dev-31f75bfecd9cef7d485b1cda3c6c38cc0b4a5c6c.tar.xz
linux-dev-31f75bfecd9cef7d485b1cda3c6c38cc0b4a5c6c.zip
apparmor: make computing policy hashes conditional on kernel parameter
Allow turning off the computation of the policy hashes via the apparmor.hash_policy kernel parameter. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy_unpack.c')
-rw-r--r--security/apparmor/policy_unpack.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 441efc965f2b..59c891ad1270 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -825,7 +825,8 @@ int aa_unpack(struct aa_loaddata *udata, struct list_head *lh,
if (error)
goto fail_profile;
- error = aa_calc_profile_hash(profile, e.version, start,
+ if (aa_g_hash_policy)
+ error = aa_calc_profile_hash(profile, e.version, start,
e.pos - start);
if (error)
goto fail_profile;
@@ -841,11 +842,13 @@ int aa_unpack(struct aa_loaddata *udata, struct list_head *lh,
list_add_tail(&ent->list, lh);
}
udata->abi = e.version & K_ABI_MASK;
- udata->hash = aa_calc_hash(udata->data, udata->size);
- if (IS_ERR(udata->hash)) {
- error = PTR_ERR(udata->hash);
- udata->hash = NULL;
- goto fail;
+ if (aa_g_hash_policy) {
+ udata->hash = aa_calc_hash(udata->data, udata->size);
+ if (IS_ERR(udata->hash)) {
+ error = PTR_ERR(udata->hash);
+ udata->hash = NULL;
+ goto fail;
+ }
}
return 0;