Lines Matching refs:profile

102  * mangle_name - mangle a profile name to std profile layout form
103 * @name: profile name to mangle (NOT NULL)
612 static void profile_query_cb(struct aa_profile *profile, struct aa_perms *perms,
615 struct aa_ruleset *rules = list_first_entry(&profile->rules,
620 if (profile_unconfined(profile))
640 aa_apply_modes_to_perms(profile, &tmp);
670 struct aa_profile *profile;
705 label_for_each_confined(i, label, profile) {
706 if (!profile->data)
709 data = rhashtable_lookup_fast(profile->data, &key,
710 profile->data->p);
759 struct aa_profile *profile;
776 * profile name and dfa string. profile_name_len is greater
791 label_for_each_in_ns(i, labels_ns(label), label, profile) {
792 profile_query_cb(profile, &perms, match_str, match_len);
795 label_for_each(i, label, profile) {
796 profile_query_cb(profile, &perms, match_str, match_len);
909 #define QUERY_CMD_PROFILE "profile\0"
928 * profile query specific format described in the query_label() function
1030 * profile based file operations
1074 struct aa_profile *profile = labels_profile(label);
1075 seq_printf(seq, "%s\n", profile->base.name);
1085 struct aa_profile *profile = labels_profile(label);
1086 seq_printf(seq, "%s\n", aa_profile_mode_names[profile->mode]);
1096 struct aa_profile *profile = labels_profile(label);
1097 if (profile->attach.xmatch_str)
1098 seq_printf(seq, "%s\n", profile->attach.xmatch_str);
1099 else if (profile->attach.xmatch->dfa)
1102 seq_printf(seq, "%s\n", profile->base.name);
1112 struct aa_profile *profile = labels_profile(label);
1115 if (profile->hash) {
1117 seq_printf(seq, "%.2x", profile->hash[i]);
1164 struct aa_profile *profile;
1171 label_for_each(it, label, profile)
1172 if (profile->ns != labels_ns(label)) {
1512 /** fns to setup dynamic per profile/namespace files **/
1516 * Requires: @profile->ns->lock held
1518 void __aafs_profile_rmdir(struct aa_profile *profile)
1523 if (!profile)
1526 list_for_each_entry(child, &profile->base.profiles, base.list)
1531 if (!profile->dents[i])
1534 proxy = d_inode(profile->dents[i])->i_private;
1535 aafs_remove(profile->dents[i]);
1537 profile->dents[i] = NULL;
1567 struct aa_profile *profile,
1570 struct aa_proxy *proxy = aa_get_proxy(profile->label.proxy);
1581 static int profile_depth(struct aa_profile *profile)
1586 for (depth = 0; profile; profile = rcu_access_pointer(profile->parent))
1625 struct aa_profile *profile;
1633 profile = labels_profile(label);
1634 depth = profile_depth(profile);
1635 target = gen_symlink_name(depth, profile->rawdata->name, name);
1680 * Requires: @profile->ns->lock held
1682 int __aafs_profile_mkdir(struct aa_profile *profile, struct dentry *parent)
1688 AA_BUG(!profile);
1689 AA_BUG(!mutex_is_locked(&profiles_ns(profile)->lock));
1693 p = aa_deref_parent(profile);
1702 if (!profile->dirname) {
1704 len = mangle_name(profile->base.name, NULL);
1705 id_len = snprintf(NULL, 0, ".%ld", profile->ns->uniq_id);
1707 profile->dirname = kmalloc(len + id_len + 1, GFP_KERNEL);
1708 if (!profile->dirname) {
1713 mangle_name(profile->base.name, profile->dirname);
1714 sprintf(profile->dirname + len, ".%ld", profile->ns->uniq_id++);
1717 dent = aafs_create_dir(profile->dirname, parent);
1720 prof_dir(profile) = dir = dent;
1722 dent = create_profile_file(dir, "name", profile,
1726 profile->dents[AAFS_PROF_NAME] = dent;
1728 dent = create_profile_file(dir, "mode", profile,
1732 profile->dents[AAFS_PROF_MODE] = dent;
1734 dent = create_profile_file(dir, "attach", profile,
1738 profile->dents[AAFS_PROF_ATTACH] = dent;
1740 if (profile->hash) {
1741 dent = create_profile_file(dir, "sha256", profile,
1745 profile->dents[AAFS_PROF_HASH] = dent;
1749 if (profile->rawdata) {
1752 profile->label.proxy, NULL, NULL,
1756 aa_get_proxy(profile->label.proxy);
1757 profile->dents[AAFS_PROF_RAW_HASH] = dent;
1760 profile->label.proxy, NULL, NULL,
1764 aa_get_proxy(profile->label.proxy);
1765 profile->dents[AAFS_PROF_RAW_ABI] = dent;
1768 profile->label.proxy, NULL, NULL,
1772 aa_get_proxy(profile->label.proxy);
1773 profile->dents[AAFS_PROF_RAW_DATA] = dent;
1777 list_for_each_entry(child, &profile->base.profiles, base.list) {
1778 error = __aafs_profile_mkdir(child, prof_child_dir(profile));
1789 __aafs_profile_rmdir(profile);
2114 * __first_profile - find the first profile in a namespace
2118 * Returns: unrefcounted profile or NULL if no profile
2119 * Requires: profile->ns.lock to be held
2136 * __next_profile - step to the next profile in a profile tree
2137 * @p: current profile in tree (NOT NULL)
2139 * Perform a depth first traversal on the profile tree in a namespace
2141 * Returns: next profile or NULL if done
2142 * Requires: profile->ns.lock to be held
2151 /* is next profile a child */
2156 /* is next profile a sibling, parent sibling, gp, sibling, .. */
2168 /* is next another profile in the namespace */
2177 * next_profile - step to the next profile in where ever it may be
2179 * @profile: current profile (NOT NULL)
2181 * Returns: next profile or NULL if there isn't one
2184 struct aa_profile *profile)
2186 struct aa_profile *next = __next_profile(profile);
2191 return __first_profile(root, __next_ns(root, profile->ns));
2195 * p_start - start a depth first traversal of profile tree
2199 * Returns: first profile under current namespace or NULL if none found
2205 struct aa_profile *profile = NULL;
2210 /* find the first profile */
2212 profile = __first_profile(root, root);
2215 for (; profile && l > 0; l--)
2216 profile = next_profile(root, profile);
2218 return profile;
2222 * p_next - read the next profile entry
2224 * @p: profile previously returned
2227 * Returns: next profile after @p or NULL if none
2233 struct aa_profile *profile = p;
2237 return next_profile(ns, profile);
2243 * @p: the last profile writen
2249 struct aa_profile *profile = p;
2252 if (profile) {
2253 for (ns = profile->ns; ns && ns != root; ns = ns->parent)
2261 * seq_show_profile - show a profile entry
2263 * @p: current position (profile) (NOT NULL)
2269 struct aa_profile *profile = (struct aa_profile *)p;
2272 aa_label_seq_xprint(f, root, &profile->label,
2376 AA_SFS_FILE_BOOLEAN("profile", 1),
2696 /* TODO: add default profile to apparmorfs */