Lines Matching defs: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)) {
1514 /** fns to setup dynamic per profile/namespace files **/
1518 * Requires: @profile->ns->lock held
1520 void __aafs_profile_rmdir(struct aa_profile *profile)
1525 if (!profile)
1528 list_for_each_entry(child, &profile->base.profiles, base.list)
1533 if (!profile->dents[i])
1536 proxy = d_inode(profile->dents[i])->i_private;
1537 aafs_remove(profile->dents[i]);
1539 profile->dents[i] = NULL;
1568 struct aa_profile *profile,
1571 struct aa_proxy *proxy = aa_get_proxy(profile->label.proxy);
1582 static int profile_depth(struct aa_profile *profile)
1587 for (depth = 0; profile; profile = rcu_access_pointer(profile->parent))
1631 struct aa_profile *profile;
1639 profile = labels_profile(label);
1640 depth = profile_depth(profile);
1641 target = gen_symlink_name(depth, profile->rawdata->name, name);
1686 * Requires: @profile->ns->lock held
1688 int __aafs_profile_mkdir(struct aa_profile *profile, struct dentry *parent)
1694 AA_BUG(!profile);
1695 AA_BUG(!mutex_is_locked(&profiles_ns(profile)->lock));
1699 p = aa_deref_parent(profile);
1708 if (!profile->dirname) {
1710 len = mangle_name(profile->base.name, NULL);
1711 id_len = snprintf(NULL, 0, ".%ld", profile->ns->uniq_id);
1713 profile->dirname = kmalloc(len + id_len + 1, GFP_KERNEL);
1714 if (!profile->dirname) {
1719 mangle_name(profile->base.name, profile->dirname);
1720 sprintf(profile->dirname + len, ".%ld", profile->ns->uniq_id++);
1723 dent = aafs_create_dir(profile->dirname, parent);
1726 prof_dir(profile) = dir = dent;
1728 dent = create_profile_file(dir, "name", profile,
1732 profile->dents[AAFS_PROF_NAME] = dent;
1734 dent = create_profile_file(dir, "mode", profile,
1738 profile->dents[AAFS_PROF_MODE] = dent;
1740 dent = create_profile_file(dir, "attach", profile,
1744 profile->dents[AAFS_PROF_ATTACH] = dent;
1746 if (profile->hash) {
1747 dent = create_profile_file(dir, "sha1", profile,
1751 profile->dents[AAFS_PROF_HASH] = dent;
1755 if (profile->rawdata) {
1758 profile->label.proxy, NULL, NULL,
1762 aa_get_proxy(profile->label.proxy);
1763 profile->dents[AAFS_PROF_RAW_HASH] = dent;
1766 profile->label.proxy, NULL, NULL,
1770 aa_get_proxy(profile->label.proxy);
1771 profile->dents[AAFS_PROF_RAW_ABI] = dent;
1774 profile->label.proxy, NULL, NULL,
1778 aa_get_proxy(profile->label.proxy);
1779 profile->dents[AAFS_PROF_RAW_DATA] = dent;
1783 list_for_each_entry(child, &profile->base.profiles, base.list) {
1784 error = __aafs_profile_mkdir(child, prof_child_dir(profile));
1795 __aafs_profile_rmdir(profile);
2120 * __first_profile - find the first profile in a namespace
2124 * Returns: unrefcounted profile or NULL if no profile
2125 * Requires: profile->ns.lock to be held
2142 * __next_profile - step to the next profile in a profile tree
2143 * @p: current profile in tree (NOT NULL)
2145 * Perform a depth first traversal on the profile tree in a namespace
2147 * Returns: next profile or NULL if done
2148 * Requires: profile->ns.lock to be held
2157 /* is next profile a child */
2162 /* is next profile a sibling, parent sibling, gp, sibling, .. */
2174 /* is next another profile in the namespace */
2183 * next_profile - step to the next profile in where ever it may be
2185 * @profile: current profile (NOT NULL)
2187 * Returns: next profile or NULL if there isn't one
2190 struct aa_profile *profile)
2192 struct aa_profile *next = __next_profile(profile);
2197 return __first_profile(root, __next_ns(root, profile->ns));
2201 * p_start - start a depth first traversal of profile tree
2205 * Returns: first profile under current namespace or NULL if none found
2211 struct aa_profile *profile = NULL;
2216 /* find the first profile */
2218 profile = __first_profile(root, root);
2221 for (; profile && l > 0; l--)
2222 profile = next_profile(root, profile);
2224 return profile;
2228 * p_next - read the next profile entry
2230 * @p: profile previously returned
2233 * Returns: next profile after @p or NULL if none
2239 struct aa_profile *profile = p;
2243 return next_profile(ns, profile);
2249 * @p: the last profile writen
2255 struct aa_profile *profile = p;
2258 if (profile) {
2259 for (ns = profile->ns; ns && ns != root; ns = ns->parent)
2267 * seq_show_profile - show a profile entry
2269 * @p: current position (profile) (NOT NULL)
2275 struct aa_profile *profile = (struct aa_profile *)p;
2278 aa_label_seq_xprint(f, root, &profile->label,
2372 AA_SFS_FILE_BOOLEAN("profile", 1),
2684 /* TODO: add default profile to apparmorfs */