aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/policy_unpack.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2012-02-16 10:07:53 -0500
committerJohn Johansen <john.johansen@canonical.com>2012-03-14 22:09:03 -0400
commitad5ff3db53c68c2f12936bc74ea5dfe0af943592 (patch)
tree72d9ac19fdca90d283a05f444870847ce5fb9f0c /security/apparmor/policy_unpack.c
parent57fa1e18091e66b7e1002816523cb218196a882e (diff)
AppArmor: Add ability to load extended policy
Add the base support for the new policy extensions. This does not bring any additional functionality, or change current semantics. Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
Diffstat (limited to 'security/apparmor/policy_unpack.c')
-rw-r--r--security/apparmor/policy_unpack.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index c50634b724b5..25fd51edc8da 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -469,7 +469,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
469{ 469{
470 struct aa_profile *profile = NULL; 470 struct aa_profile *profile = NULL;
471 const char *name = NULL; 471 const char *name = NULL;
472 int error = -EPROTO; 472 int i, error = -EPROTO;
473 kernel_cap_t tmpcap; 473 kernel_cap_t tmpcap;
474 u32 tmp; 474 u32 tmp;
475 475
@@ -562,6 +562,28 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
562 if (!unpack_rlimits(e, profile)) 562 if (!unpack_rlimits(e, profile))
563 goto fail; 563 goto fail;
564 564
565 if (unpack_nameX(e, AA_STRUCT, "policydb")) {
566 /* generic policy dfa - optional and may be NULL */
567 profile->policy.dfa = unpack_dfa(e);
568 if (IS_ERR(profile->policy.dfa)) {
569 error = PTR_ERR(profile->policy.dfa);
570 profile->policy.dfa = NULL;
571 goto fail;
572 }
573 if (!unpack_u32(e, &profile->policy.start[0], "start"))
574 /* default start state */
575 profile->policy.start[0] = DFA_START;
576 /* setup class index */
577 for (i = AA_CLASS_FILE; i <= AA_CLASS_LAST; i++) {
578 profile->policy.start[i] =
579 aa_dfa_next(profile->policy.dfa,
580 profile->policy.start[0],
581 i);
582 }
583 if (!unpack_nameX(e, AA_STRUCTEND, NULL))
584 goto fail;
585 }
586
565 /* get file rules */ 587 /* get file rules */
566 profile->file.dfa = unpack_dfa(e); 588 profile->file.dfa = unpack_dfa(e);
567 if (IS_ERR(profile->file.dfa)) { 589 if (IS_ERR(profile->file.dfa)) {