__lookupn_profile(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– __lookupn_profile πŸ’–

okay so bestie, welcome to the __lookupn_profile(9) page from the Kernel API Manual β€” this is the kernel-side lore, and honestly it's giving "short but mighty" ✨


πŸŽ€ NAME πŸŽ€

__lookupn_profile β€” lookup the profile matching @hname

like literally that's the whole job. find the profile. slay πŸ’…


✨ SYNOPSIS ✨

struct aa_profile * __lookupn_profile (struct aa_policy *base , const
char *hname , size_t n );

so you hand it a base, a hname, and an n, and it gives you back a struct aa_profile *. iconic signature tbh 🫢


🌸 ARGUMENTS 🌸

  • base β€” the base list you start looking the profile name up from. NOT NULL, no exceptions, don't even try it πŸ™ˆ
  • hname β€” the hierarchical profile name. also NOT NULL bestie, we are not playing games today πŸ’€
  • n β€” the length of hname. yes, you have to tell it. it's not gonna count for you, that's not the vibe ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

Requires: rcu_read_lock be held πŸ”’

read that again, bestie. this function expects the lock to already be held β€” it's not out here grabbing locks for you, it's a "you better have done your homework" kind of function 🧚

what it actually does: it does a relative name lookup, recursing through the profile tree. so it's like walking down the tree, level by level, hunting for the match. very main character energy for a tree traversal ngl 🌈


⭐ RETURN ⭐

an unrefcounted profile pointer β€” or NULL if it's not found 😭

unrefcounted means unrefcounted, okay? the refcount is not being bumped for you. that's on you. do not come crying to me later πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

this is the extended friend group, fr fr β€” go say hi to all of them:

Kernel file ./security/apparmor/policy.c aa_pdb_free_kref(9), __add_profile(9), __list_remove_profile(9), __remove_profile(9), __aa_profile_list_release(9), aa_free_data(9), aa_free_profile(9), aa_alloc_profile(9), __strn_find_child(9), __find_child(9), aa_find_child(9), __lookup_parent(9), __create_missing_ancestors(9), aa_lookupn_profile(9), __aa_new_learning_profile(9), replacement_allowed(9), audit_policy(9), aa_policy_view_capable(9), aa_may_manage_policy(9), __replace_profile(9), __lookup_replace(9), aa_replace_profiles(9), aa_remove_profiles(9)


and that's the whole page, bestie, you ate that πŸ“

sign-off time: this little gem lives in ./security/apparmor, it's part of the Kernel API Manual, and it's dated October 2026 β€” go forth and look up those profiles responsibly, iykyk πŸ’œπŸ¦‹

πŸ“¦ where this page comes from