]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
apparmor: check label build before no_new_privs test
authorRuoyu Wang <ruoyuw560@gmail.com>
Mon, 8 Jun 2026 06:36:31 +0000 (14:36 +0800)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 14 Jun 2026 03:14:06 +0000 (20:14 -0700)
commita58cafd38b46fb1a2220e2fbbcfe291ea75fa147
tree4e9757242c634b6ff3af3f7b793df335ec873b1e
parentd62d9bfe050f44f772d05a32079dba3e3523ab2a
apparmor: check label build before no_new_privs test

aa_change_profile() builds a replacement label with
fn_label_build_in_scope() before the no_new_privs subset check. The build
helper can fail and return NULL or an ERR_PTR, but the result was passed
to aa_label_is_unconfined_subset() before the existing IS_ERR_OR_NULL()
check.

Reuse the existing target-label build failure handling immediately after
the build. This preserves the current audit handling while preventing the
subset helper from dereferencing an invalid label.

Fixes: e00b02bb6ac2a ("apparmor: move change_profile mediation to using labels")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/domain.c