__replace_profile(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME

okay so bestie, gather round β€” __replace_profile means replace @old with @new on a list. that's it, that's the whole vibe πŸŽ€

this one lives in the Kernel API Manual (section 9, kernel girlies rise) so you already know it's deep-in-the-kernel territory. no cap 🧚


✨ SYNOPSIS

void __replace_profile (struct aa_profile *old , struct aa_profile *new
);

literally just hand it an old and a new and it does the swap, periodt πŸ’…


🫢 ARGUMENTS

  • old β€” the profile to be replaced. and yeah, it's NOT NULL β€” do not pass her a null, she will not be okay 😭
  • new β€” the profile you're replacing old with. also NOT NULL bestie, same energy, please respect it πŸ™ˆ

🌸 DESCRIPTION

so here's what's actually going down πŸ‘‘

It will duplicate and refcount elements that new inherits from old, and it will inherit old children. yes, the children get inherited β€” it's giving found family, it's giving main character energy πŸ¦‹

Then: refcount new for list, put old list refcount. that's the handoff, the torch-passing moment, iconic behavior only ⭐

⚠️ Requires: namespace list lock be held, or list not be shared. this is not a suggestion, this is the rules β€” do not skip the lock and then act surprised, i'm begging 🫢

πŸ”₯ SEE ALSO

the whole squad, fr fr β€” all of these are in the 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), __lookupn_profile(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), __lookup_replace(9), aa_replace_profiles(9), aa_remove_profiles(9)

like, the entire friend group showed up. iykyk πŸ’œ


okay that's the page!! mwah πŸ’– this lil slice of kernel lore is from ./security/apparmor and it's dated October 2026 β€” yes, 2026, she's from the future and she's still slaying. go hold that list lock bestie, ily, bye πŸŽ€βœ¨πŸŒˆ

πŸ“¦ where this page comes from