Lines Matching full:profile
53 * @new: profile if it has been allocated (MAYBE NULL)
54 * @ns_name: name of the ns the profile is to be loaded to (MAY BE NULL)
55 * @name: name of the profile being manipulated (MAYBE NULL)
66 struct aa_profile *profile = labels_profile(aa_current_raw_label()); in audit_iface() local
78 return aa_audit(AUDIT_APPARMOR_STATUS, profile, &ad, audit_cb); in audit_iface()
453 * unpack_trans_table - unpack a profile transition table
534 static bool unpack_xattrs(struct aa_ext *e, struct aa_profile *profile) in unpack_xattrs() argument
544 profile->attach.xattr_count = size; in unpack_xattrs()
545 profile->attach.xattrs = kcalloc(size, sizeof(char *), GFP_KERNEL); in unpack_xattrs()
546 if (!profile->attach.xattrs) in unpack_xattrs()
549 if (!aa_unpack_strdup(e, &profile->attach.xattrs[i], NULL)) in unpack_xattrs()
776 *info = "failed to unpack profile transition table"; in unpack_pdb()
811 * unpack_profile - unpack a serialized profile
815 * NOTE: unpack profile sets audit struct if there is a failure
820 struct aa_profile *profile = NULL; in unpack_profile() local
822 const char *info = "failed to unpack profile"; in unpack_profile()
834 if (!aa_unpack_nameX(e, AA_STRUCT, "profile")) in unpack_profile()
844 info = "empty profile name"; in unpack_profile()
856 profile = aa_alloc_profile(name, NULL, GFP_KERNEL); in unpack_profile()
857 if (!profile) { in unpack_profile()
862 rules = list_first_entry(&profile->rules, typeof(*rules), list); in unpack_profile()
864 /* profile renaming is optional */ in unpack_profile()
865 (void) aa_unpack_str(e, &profile->rename, "rename"); in unpack_profile()
868 (void) aa_unpack_str(e, &profile->attach.xmatch_str, "attach"); in unpack_profile()
871 error = unpack_pdb(e, &profile->attach.xmatch, false, false, &info); in unpack_profile()
878 if (profile->attach.xmatch->dfa) { in unpack_profile()
883 profile->attach.xmatch_len = tmp; in unpack_profile()
884 profile->attach.xmatch->start[AA_CLASS_XMATCH] = DFA_START; in unpack_profile()
885 if (!profile->attach.xmatch->perms) { in unpack_profile()
886 error = aa_compat_map_xmatch(profile->attach.xmatch); in unpack_profile()
896 profile->disconnected = disconnected; in unpack_profile()
898 /* per profile debug flags (complain, audit) */ in unpack_profile()
900 info = "profile missing flags"; in unpack_profile()
903 info = "failed to unpack profile flags"; in unpack_profile()
907 profile->label.flags |= FLAG_HAT; in unpack_profile()
909 profile->label.flags |= FLAG_DEBUG1; in unpack_profile()
911 profile->label.flags |= FLAG_DEBUG2; in unpack_profile()
915 profile->mode = APPARMOR_COMPLAIN; in unpack_profile()
917 profile->mode = APPARMOR_ENFORCE; in unpack_profile()
919 profile->mode = APPARMOR_KILL; in unpack_profile()
921 profile->mode = APPARMOR_UNCONFINED; in unpack_profile()
922 profile->label.flags |= FLAG_UNCONFINED; in unpack_profile()
924 profile->mode = APPARMOR_USER; in unpack_profile()
931 profile->audit = AUDIT_ALL; in unpack_profile()
937 if (aa_unpack_u32(e, &profile->path_flags, "path_flags")) in unpack_profile()
938 profile->path_flags |= profile->label.flags & in unpack_profile()
942 profile->path_flags = PATH_MEDIATE_DELETED; in unpack_profile()
944 info = "failed to unpack profile capabilities"; in unpack_profile()
954 info = "failed to unpack upper profile capabilities"; in unpack_profile()
969 info = "failed to unpack extended profile capabilities"; in unpack_profile()
980 if (!unpack_xattrs(e, profile)) { in unpack_profile()
981 info = "failed to unpack profile xattrs"; in unpack_profile()
986 info = "failed to unpack profile rlimits"; in unpack_profile()
991 info = "failed to unpack profile secmark rules"; in unpack_profile()
1045 profile->data = kzalloc(sizeof(*profile->data), GFP_KERNEL); in unpack_profile()
1046 if (!profile->data) { in unpack_profile()
1057 if (rhashtable_init(profile->data, ¶ms)) { in unpack_profile()
1080 if (rhashtable_insert_fast(profile->data, &data->head, in unpack_profile()
1081 profile->data->p)) { in unpack_profile()
1097 info = "failed to unpack end of profile"; in unpack_profile()
1101 return profile; in unpack_profile()
1111 if (profile) in unpack_profile()
1115 audit_iface(profile, NULL, name, info, e, error); in unpack_profile()
1116 aa_free_profile(profile); in unpack_profile()
1138 audit_iface(NULL, NULL, NULL, "invalid profile format", in verify_header()
1234 * verify_profile - Do post unpack analysis to verify profile consistency
1235 * @profile: profile to verify (NOT NULL)
1241 static int verify_profile(struct aa_profile *profile) in verify_profile() argument
1243 struct aa_ruleset *rules = list_first_entry(&profile->rules, in verify_profile()
1250 audit_iface(profile, NULL, NULL, in verify_profile()
1257 audit_iface(profile, NULL, NULL, in verify_profile()
1264 audit_iface(profile, NULL, NULL, in verify_profile()
1269 audit_iface(profile, NULL, NULL, in verify_profile()
1273 if (!verify_perms(profile->attach.xmatch)) { in verify_profile()
1274 audit_iface(profile, NULL, NULL, in verify_profile()
1399 * aa_unpack - unpack packed binary profile(s) data loaded from user space
1402 * @ns: Returns namespace profile is in if specified else NULL (NOT NULL)
1404 * Unpack user data and return refcounted allocated profile(s) stored in
1408 * Returns: profile(s) on @lh else error pointer if fails to unpack
1414 struct aa_profile *profile = NULL; in aa_unpack() local
1431 profile = unpack_profile(&e, &ns_name); in aa_unpack()
1432 if (IS_ERR(profile)) { in aa_unpack()
1433 error = PTR_ERR(profile); in aa_unpack()
1437 error = verify_profile(profile); in aa_unpack()
1442 error = aa_calc_profile_hash(profile, e.version, start, in aa_unpack()
1453 ent->new = profile; in aa_unpack()
1477 aa_put_profile(profile); in aa_unpack()