__label_replace(9)
π
__label_replace(9) β like, the Kernel API Manual page you actually wanna read
okay bestie, so this is a page from the Kernel API Manual, and it's literally about swapping one label for another inside a label set. that's the whole vibe. π
β¨ NAME β¨
__label_replace β replace @old with @new in label set
like... the name is literally the plot. no notes. π
π¦ SYNOPSIS π¦
bool __label_replace (struct aa_label *old , struct aa_label *new );
it returns a bool, it takes two struct aa_label * args, and the spacing in there is exactly what the manpage says, so don't come for me about it fr fr π
πΈ ARGUMENTS πΈ
oldβ the label you're yeeting out of the label set. bye bestie πnewβ the label that's takingold's spot, like a glow-up replacement. slay β¨
π₯ DESCRIPTION π₯
okay so here's the requirement, and it's giving strict: you need labels_set(old)->lock write_lock valid, and a ref count must be held on new.
read that again. write lock on the labels_set of old, and a valid ref count held on new. that's the entry fee, no exceptions π«Ά
β RETURN β
returns true if old was actually in the set and got replaced by new.
if it wasn't in the set? then it's not true. simple as that π
π§ NOTE π§
heads up bestie β the current implementation requires the label set be ordered in such a way thatnewdirectly replacesold's position in the set. like, the position has to line up.
and specifically: ie. using pointer comparison of the label address would not work. so don't try that. it's not gonna eat, it's gonna flop π
π SEE ALSO π
the whole friend group, in the order the manpage gives them, and yes i'm listing every single one because i'm not about to do you dirty like that π
Kernel file ./security/apparmor/label.cns_cmp(9)profile_cmp(9)vec_cmp(9)aa_vec_unique(9)aa_label_alloc(9)label_cmp(9)__aa_label_next_not_in_set(9)aa_label_is_subset(9)aa_label_is_unconfined_subset(9)__label_remove(9)__label_insert(9)__vec_find(9)__label_find(9)aa_label_remove(9)aa_label_replace(9)vec_find(9)aa_label_insert(9)aa_label_next_in_merge(9)label_merge_cmp(9)label_merge_insert(9)labelset_of_merge(9)__label_find_merge(9)aa_label_find_merge(9)aa_label_merge(9)label_compound_match(9)label_components_match(9)aa_label_match(9)aa_update_label_name(9)aa_profile_snxprint(9)aa_label_snxprint(9)aa_label_asxprint(9)aa_label_acntsxprint(9)aa_label_strn_parse(9)aa_labelset_destroy(9)__label_update(9)__labelset_update(9)__aa_labelset_update_subtree(9)
and that's the page!! π this whole thing lives under ./security/apparmor, and it's dated October 2026 in the <pink>Kernel API Manual</pink> β so yeah, future-dated and iconic. go replace some labels bestie, but hold that write lock first πππ¦
π¦ 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