find_attach(9)
π find_attach π
Hiii bestie, welcome to the Kernel API Manual, section 9 edition π«Ά. This page is all about find_attach, and yes, it's literally doing attachment search for unconfined processes. Every pointer down there is NOT NULL, so don't try to sneak a null in, okay? ππ
β¨ NAME β¨
find_attach β do attachment search for unconfined processes. That's the vibe: attachment search, unconfined processes, iconic behavior, periodt π.
π¦ SYNOPSIS π¦
struct aa_label * find_attach (const struct path *path , struct aa_ns *ns , struct list_head *head , const char *name , const char **info );
π ARGUMENTS π
pathβ path of file in question, and it isNOT NULL. fr fr, not null π.nsβ the current namespace,NOT NULL. main character namespace energy π.headβ profile list to walk,NOT NULL. you're walking the list, bestie πΆββοΈ.nameβ to match against,NOT NULL. matching time β¨.infoβ info message if there was an error,NOT NULL. so if something goes sideways, this is where the tea gets reported π.
π₯ DESCRIPTION π₯
okay so find_attach does a linear search on the profiles in the list. Slay, but make it linear π
.
There's a matching preference, and it's giving very "ranked choice, but kernel profiles":
- an exact match is preferred over a name which uses expressions to match, and
- matching expressions with the greatest
xmatch_lenare preferred. iykyk β¨.
Requires: head not be shared or have appropriate locks held. This is not a drill, bestie β get your locking situation correct ππ.
β RETURN β
- Returns a
label, orNULLif no match found. No match, no label, justNULLand vibes π.
π SEE ALSO π
This page is in a whole friend group of kernel AppArmor functions plus one file path, so here's the full roll call π«Ά:
- Kernel file
./security/apparmor/domain.c may_change_ptraced_domain(9)label_compound_match(9)label_components_match(9)label_match(9)change_profile_perms(9)aa_xattrs_match(9)x_table_lookup(9)x_to_label(9)apparmor_bprm_creds_for_exec(9)aa_change_hat(9)aa_change_profile(9)
that's the whole page, bestie π. This little gem comes from ./security/apparmor, dated October 2026, and it is absolutely living its best kernel-manual life. mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms