Lines Matching refs:profile
108 struct aa_profile *profile = labels_profile(aa_current_raw_label()); in audit_iface() local
120 return aa_audit(AUDIT_APPARMOR_STATUS, profile, &sa, audit_cb); in audit_iface()
474 static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile) in unpack_trans_table() argument
486 profile->file.trans.table = kcalloc(size, sizeof(char *), in unpack_trans_table()
488 if (!profile->file.trans.table) in unpack_trans_table()
491 profile->file.trans.size = size; in unpack_trans_table()
500 profile->file.trans.table[i] = str; in unpack_trans_table()
538 aa_free_domain_entries(&profile->file.trans); in unpack_trans_table()
543 static bool unpack_xattrs(struct aa_ext *e, struct aa_profile *profile) in unpack_xattrs() argument
551 profile->xattr_count = size; in unpack_xattrs()
552 profile->xattrs = kcalloc(size, sizeof(char *), GFP_KERNEL); in unpack_xattrs()
553 if (!profile->xattrs) in unpack_xattrs()
556 if (!unpack_strdup(e, &profile->xattrs[i], NULL)) in unpack_xattrs()
572 static bool unpack_secmark(struct aa_ext *e, struct aa_profile *profile) in unpack_secmark() argument
580 profile->secmark = kcalloc(size, sizeof(struct aa_secmark), in unpack_secmark()
582 if (!profile->secmark) in unpack_secmark()
585 profile->secmark_count = size; in unpack_secmark()
588 if (!unpack_u8(e, &profile->secmark[i].audit, NULL)) in unpack_secmark()
590 if (!unpack_u8(e, &profile->secmark[i].deny, NULL)) in unpack_secmark()
592 if (!unpack_strdup(e, &profile->secmark[i].label, NULL)) in unpack_secmark()
604 if (profile->secmark) { in unpack_secmark()
606 kfree(profile->secmark[i].label); in unpack_secmark()
607 kfree(profile->secmark); in unpack_secmark()
608 profile->secmark_count = 0; in unpack_secmark()
609 profile->secmark = NULL; in unpack_secmark()
616 static bool unpack_rlimits(struct aa_ext *e, struct aa_profile *profile) in unpack_rlimits() argument
626 profile->rlimits.mask = tmp; in unpack_rlimits()
636 profile->rlimits.limits[a].rlim_max = tmp2; in unpack_rlimits()
673 struct aa_profile *profile = NULL; in unpack_profile() local
708 profile = aa_alloc_profile(name, NULL, GFP_KERNEL); in unpack_profile()
709 if (!profile) in unpack_profile()
713 (void) unpack_str(e, &profile->rename, "rename"); in unpack_profile()
716 (void) unpack_str(e, &profile->attach, "attach"); in unpack_profile()
719 profile->xmatch = unpack_dfa(e); in unpack_profile()
720 if (IS_ERR(profile->xmatch)) { in unpack_profile()
721 error = PTR_ERR(profile->xmatch); in unpack_profile()
722 profile->xmatch = NULL; in unpack_profile()
727 if (profile->xmatch) { in unpack_profile()
732 profile->xmatch_len = tmp; in unpack_profile()
736 (void) unpack_str(e, &profile->disconnected, "disconnected"); in unpack_profile()
747 profile->label.flags |= FLAG_HAT; in unpack_profile()
751 profile->mode = APPARMOR_COMPLAIN; in unpack_profile()
753 profile->mode = APPARMOR_KILL; in unpack_profile()
755 profile->mode = APPARMOR_UNCONFINED; in unpack_profile()
759 profile->audit = AUDIT_ALL; in unpack_profile()
765 if (unpack_u32(e, &profile->path_flags, "path_flags")) in unpack_profile()
766 profile->path_flags |= profile->label.flags & in unpack_profile()
770 profile->path_flags = PATH_MEDIATE_DELETED; in unpack_profile()
773 if (!unpack_u32(e, &(profile->caps.allow.cap[0]), NULL)) in unpack_profile()
775 if (!unpack_u32(e, &(profile->caps.audit.cap[0]), NULL)) in unpack_profile()
777 if (!unpack_u32(e, &(profile->caps.quiet.cap[0]), NULL)) in unpack_profile()
785 if (!unpack_u32(e, &(profile->caps.allow.cap[1]), NULL)) in unpack_profile()
787 if (!unpack_u32(e, &(profile->caps.audit.cap[1]), NULL)) in unpack_profile()
789 if (!unpack_u32(e, &(profile->caps.quiet.cap[1]), NULL)) in unpack_profile()
800 if (!unpack_u32(e, &(profile->caps.extended.cap[0]), NULL)) in unpack_profile()
802 if (!unpack_u32(e, &(profile->caps.extended.cap[1]), NULL)) in unpack_profile()
808 if (!unpack_xattrs(e, profile)) { in unpack_profile()
813 if (!unpack_rlimits(e, profile)) { in unpack_profile()
818 if (!unpack_secmark(e, profile)) { in unpack_profile()
826 profile->policy.dfa = unpack_dfa(e); in unpack_profile()
827 if (IS_ERR(profile->policy.dfa)) { in unpack_profile()
828 error = PTR_ERR(profile->policy.dfa); in unpack_profile()
829 profile->policy.dfa = NULL; in unpack_profile()
831 } else if (!profile->policy.dfa) { in unpack_profile()
835 if (!unpack_u32(e, &profile->policy.start[0], "start")) in unpack_profile()
837 profile->policy.start[0] = DFA_START; in unpack_profile()
840 profile->policy.start[i] = in unpack_profile()
841 aa_dfa_next(profile->policy.dfa, in unpack_profile()
842 profile->policy.start[0], in unpack_profile()
848 profile->policy.dfa = aa_get_dfa(nulldfa); in unpack_profile()
851 profile->file.dfa = unpack_dfa(e); in unpack_profile()
852 if (IS_ERR(profile->file.dfa)) { in unpack_profile()
853 error = PTR_ERR(profile->file.dfa); in unpack_profile()
854 profile->file.dfa = NULL; in unpack_profile()
857 } else if (profile->file.dfa) { in unpack_profile()
858 if (!unpack_u32(e, &profile->file.start, "dfa_start")) in unpack_profile()
860 profile->file.start = DFA_START; in unpack_profile()
861 } else if (profile->policy.dfa && in unpack_profile()
862 profile->policy.start[AA_CLASS_FILE]) { in unpack_profile()
863 profile->file.dfa = aa_get_dfa(profile->policy.dfa); in unpack_profile()
864 profile->file.start = profile->policy.start[AA_CLASS_FILE]; in unpack_profile()
866 profile->file.dfa = aa_get_dfa(nulldfa); in unpack_profile()
868 if (!unpack_trans_table(e, profile)) { in unpack_profile()
875 profile->data = kzalloc(sizeof(*profile->data), GFP_KERNEL); in unpack_profile()
876 if (!profile->data) in unpack_profile()
886 if (rhashtable_init(profile->data, ¶ms)) { in unpack_profile()
907 rhashtable_insert_fast(profile->data, &data->head, in unpack_profile()
908 profile->data->p); in unpack_profile()
922 return profile; in unpack_profile()
925 if (profile) in unpack_profile()
929 audit_iface(profile, NULL, name, info, e, error); in unpack_profile()
930 aa_free_profile(profile); in unpack_profile()
1014 static int verify_profile(struct aa_profile *profile) in verify_profile() argument
1016 if (profile->file.dfa && in verify_profile()
1017 !verify_dfa_xindex(profile->file.dfa, in verify_profile()
1018 profile->file.trans.size)) { in verify_profile()
1019 audit_iface(profile, NULL, NULL, "Invalid named transition", in verify_profile()
1062 struct aa_profile *profile = NULL; in aa_unpack() local
1079 profile = unpack_profile(&e, &ns_name); in aa_unpack()
1080 if (IS_ERR(profile)) { in aa_unpack()
1081 error = PTR_ERR(profile); in aa_unpack()
1085 error = verify_profile(profile); in aa_unpack()
1090 error = aa_calc_profile_hash(profile, e.version, start, in aa_unpack()
1101 ent->new = profile; in aa_unpack()
1117 aa_put_profile(profile); in aa_unpack()