Lines Matching full:profile
102 * mangle_name - mangle a profile name to std profile layout form
103 * @name: profile name to mangle (NOT NULL)
611 static void profile_query_cb(struct aa_profile *profile, struct aa_perms *perms, in profile_query_cb() argument
618 if (profile_unconfined(profile)) in profile_query_cb()
620 if (profile->file.dfa && *match_str == AA_CLASS_FILE) { in profile_query_cb()
621 dfa = profile->file.dfa; in profile_query_cb()
622 state = aa_dfa_match_len(dfa, profile->file.start, in profile_query_cb()
629 } else if (profile->policy.dfa) { in profile_query_cb()
630 if (!PROFILE_MEDIATES(profile, *match_str)) in profile_query_cb()
632 dfa = profile->policy.dfa; in profile_query_cb()
633 state = aa_dfa_match_len(dfa, profile->policy.start[0], in profile_query_cb()
638 aa_apply_modes_to_perms(profile, &tmp); in profile_query_cb()
668 struct aa_profile *profile; in query_data() local
703 label_for_each_confined(i, label, profile) { in query_data()
704 if (!profile->data) in query_data()
707 data = rhashtable_lookup_fast(profile->data, &key, in query_data()
708 profile->data->p); in query_data()
757 struct aa_profile *profile; in query_label() local
774 * profile name and dfa string. profile_name_len is greater in query_label()
789 label_for_each_in_ns(i, labels_ns(label), label, profile) { in query_label()
790 profile_query_cb(profile, &perms, match_str, match_len); in query_label()
793 label_for_each(i, label, profile) { in query_label()
794 profile_query_cb(profile, &perms, match_str, match_len); in query_label()
905 #define QUERY_CMD_PROFILE "profile\0"
924 * profile query specific format described in the query_label() function
1026 * profile based file operations
1070 struct aa_profile *profile = labels_profile(label); in seq_profile_name_show() local
1071 seq_printf(seq, "%s\n", profile->base.name); in seq_profile_name_show()
1081 struct aa_profile *profile = labels_profile(label); in seq_profile_mode_show() local
1082 seq_printf(seq, "%s\n", aa_profile_mode_names[profile->mode]); in seq_profile_mode_show()
1092 struct aa_profile *profile = labels_profile(label); in seq_profile_attach_show() local
1093 if (profile->attach) in seq_profile_attach_show()
1094 seq_printf(seq, "%s\n", profile->attach); in seq_profile_attach_show()
1095 else if (profile->xmatch) in seq_profile_attach_show()
1098 seq_printf(seq, "%s\n", profile->base.name); in seq_profile_attach_show()
1108 struct aa_profile *profile = labels_profile(label); in seq_profile_hash_show() local
1111 if (profile->hash) { in seq_profile_hash_show()
1113 seq_printf(seq, "%.2x", profile->hash[i]); in seq_profile_hash_show()
1160 struct aa_profile *profile; in seq_ns_nsstacked_show() local
1167 label_for_each(it, label, profile) in seq_ns_nsstacked_show()
1168 if (profile->ns != labels_ns(label)) { in seq_ns_nsstacked_show()
1504 /** fns to setup dynamic per profile/namespace files **/
1508 * Requires: @profile->ns->lock held
1510 void __aafs_profile_rmdir(struct aa_profile *profile) in __aafs_profile_rmdir() argument
1515 if (!profile) in __aafs_profile_rmdir()
1518 list_for_each_entry(child, &profile->base.profiles, base.list) in __aafs_profile_rmdir()
1523 if (!profile->dents[i]) in __aafs_profile_rmdir()
1526 proxy = d_inode(profile->dents[i])->i_private; in __aafs_profile_rmdir()
1527 aafs_remove(profile->dents[i]); in __aafs_profile_rmdir()
1529 profile->dents[i] = NULL; in __aafs_profile_rmdir()
1555 struct aa_profile *profile, in create_profile_file() argument
1558 struct aa_proxy *proxy = aa_get_proxy(profile->label.proxy); in create_profile_file()
1569 static int profile_depth(struct aa_profile *profile) in profile_depth() argument
1574 for (depth = 0; profile; profile = rcu_access_pointer(profile->parent)) in profile_depth()
1618 struct aa_profile *profile; in rawdata_get_link_base() local
1626 profile = labels_profile(label); in rawdata_get_link_base()
1627 depth = profile_depth(profile); in rawdata_get_link_base()
1628 target = gen_symlink_name(depth, profile->rawdata->name, name); in rawdata_get_link_base()
1673 * Requires: @profile->ns->lock held
1675 int __aafs_profile_mkdir(struct aa_profile *profile, struct dentry *parent) in __aafs_profile_mkdir() argument
1681 AA_BUG(!profile); in __aafs_profile_mkdir()
1682 AA_BUG(!mutex_is_locked(&profiles_ns(profile)->lock)); in __aafs_profile_mkdir()
1686 p = aa_deref_parent(profile); in __aafs_profile_mkdir()
1695 if (!profile->dirname) { in __aafs_profile_mkdir()
1697 len = mangle_name(profile->base.name, NULL); in __aafs_profile_mkdir()
1698 id_len = snprintf(NULL, 0, ".%ld", profile->ns->uniq_id); in __aafs_profile_mkdir()
1700 profile->dirname = kmalloc(len + id_len + 1, GFP_KERNEL); in __aafs_profile_mkdir()
1701 if (!profile->dirname) { in __aafs_profile_mkdir()
1706 mangle_name(profile->base.name, profile->dirname); in __aafs_profile_mkdir()
1707 sprintf(profile->dirname + len, ".%ld", profile->ns->uniq_id++); in __aafs_profile_mkdir()
1710 dent = aafs_create_dir(profile->dirname, parent); in __aafs_profile_mkdir()
1713 prof_dir(profile) = dir = dent; in __aafs_profile_mkdir()
1715 dent = create_profile_file(dir, "name", profile, in __aafs_profile_mkdir()
1719 profile->dents[AAFS_PROF_NAME] = dent; in __aafs_profile_mkdir()
1721 dent = create_profile_file(dir, "mode", profile, in __aafs_profile_mkdir()
1725 profile->dents[AAFS_PROF_MODE] = dent; in __aafs_profile_mkdir()
1727 dent = create_profile_file(dir, "attach", profile, in __aafs_profile_mkdir()
1731 profile->dents[AAFS_PROF_ATTACH] = dent; in __aafs_profile_mkdir()
1733 if (profile->hash) { in __aafs_profile_mkdir()
1734 dent = create_profile_file(dir, "sha1", profile, in __aafs_profile_mkdir()
1738 profile->dents[AAFS_PROF_HASH] = dent; in __aafs_profile_mkdir()
1742 if (profile->rawdata) { in __aafs_profile_mkdir()
1745 profile->label.proxy, NULL, NULL, in __aafs_profile_mkdir()
1749 aa_get_proxy(profile->label.proxy); in __aafs_profile_mkdir()
1750 profile->dents[AAFS_PROF_RAW_HASH] = dent; in __aafs_profile_mkdir()
1753 profile->label.proxy, NULL, NULL, in __aafs_profile_mkdir()
1757 aa_get_proxy(profile->label.proxy); in __aafs_profile_mkdir()
1758 profile->dents[AAFS_PROF_RAW_ABI] = dent; in __aafs_profile_mkdir()
1761 profile->label.proxy, NULL, NULL, in __aafs_profile_mkdir()
1765 aa_get_proxy(profile->label.proxy); in __aafs_profile_mkdir()
1766 profile->dents[AAFS_PROF_RAW_DATA] = dent; in __aafs_profile_mkdir()
1770 list_for_each_entry(child, &profile->base.profiles, base.list) { in __aafs_profile_mkdir()
1771 error = __aafs_profile_mkdir(child, prof_child_dir(profile)); in __aafs_profile_mkdir()
1782 __aafs_profile_rmdir(profile); in __aafs_profile_mkdir()
2105 * __first_profile - find the first profile in a namespace
2109 * Returns: unrefcounted profile or NULL if no profile
2110 * Requires: profile->ns.lock to be held
2127 * __next_profile - step to the next profile in a profile tree
2128 * @p: current profile in tree (NOT NULL)
2130 * Perform a depth first traversal on the profile tree in a namespace
2132 * Returns: next profile or NULL if done
2133 * Requires: profile->ns.lock to be held
2142 /* is next profile a child */ in __next_profile()
2147 /* is next profile a sibling, parent sibling, gp, sibling, .. */ in __next_profile()
2159 /* is next another profile in the namespace */ in __next_profile()
2168 * next_profile - step to the next profile in where ever it may be
2170 * @profile: current profile (NOT NULL)
2172 * Returns: next profile or NULL if there isn't one
2175 struct aa_profile *profile) in next_profile() argument
2177 struct aa_profile *next = __next_profile(profile); in next_profile()
2182 return __first_profile(root, __next_ns(root, profile->ns)); in next_profile()
2186 * p_start - start a depth first traversal of profile tree
2190 * Returns: first profile under current namespace or NULL if none found
2196 struct aa_profile *profile = NULL; in p_start() local
2201 /* find the first profile */ in p_start()
2203 profile = __first_profile(root, root); in p_start()
2206 for (; profile && l > 0; l--) in p_start()
2207 profile = next_profile(root, profile); in p_start()
2209 return profile; in p_start()
2213 * p_next - read the next profile entry
2215 * @p: profile previously returned
2218 * Returns: next profile after @p or NULL if none
2224 struct aa_profile *profile = p; in p_next() local
2228 return next_profile(ns, profile); in p_next()
2234 * @p: the last profile writen
2240 struct aa_profile *profile = p; in p_stop() local
2243 if (profile) { in p_stop()
2244 for (ns = profile->ns; ns && ns != root; ns = ns->parent) in p_stop()
2252 * seq_show_profile - show a profile entry
2254 * @p: current position (profile) (NOT NULL)
2260 struct aa_profile *profile = (struct aa_profile *)p; in seq_show_profile() local
2263 aa_label_seq_xprint(f, root, &profile->label, in seq_show_profile()
2356 AA_SFS_FILE_BOOLEAN("profile", 1),
2666 /* TODO: add default profile to apparmorfs */ in aa_create_aafs()