[PATCH] apparmor: fix label replacement compiled out of __label_insert()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Nov 19 20:42:00 UTC 2026


> __label_insert() replaces an equal label in the labelset from inside
> an assertion.
> 
> 	AA_BUG(!__label_replace(this, label));
> 
> AA_BUG() evaluates its argument only if
> CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS is set. That option depends on
> CONFIG_SECURITY_APPARMOR_DEBUG, which is off by default. Without it,
> the compiler discards the call to __label_replace(). The new label
> does not go into the tree and does not get FLAG_IN_TREE. The caller,
> __label_update(), then removes the old label from the tree.
> 
> The proxy of the old label points to the new label. A task that
> holds the old label therefore moves to the new label after the first
> profile replacement. The new label is not in the labelset, so
> [ ... ]
> result.
> 
> Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels")
> Cc: stable at vger.kernel.org
> Signed-off-by: Andrew Kroh <andrew.kroh at xata.io>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119203650.51147-1-andrew.kroh@xata.io?part=1




More information about the Linux-security-module-archive mailing list