]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: fix: accept2 being specifie even when permission table is presnt
authorJohn Johansen <john.johansen@canonical.com>
Thu, 22 May 2025 20:54:05 +0000 (13:54 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 20 Jul 2025 09:31:13 +0000 (02:31 -0700)
The transition to the perms32 permission table dropped the need for
the accept2 table as permissions. However accept2 can be used for
flags and may be present even when the perms32 table is present. So
instead of checking on version, check whether the table is present.

Fixes: 2e12c5f06017 ("apparmor: add additional flags to extended permission.")
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_unpack.c

index 553e52df3aa9c5e9fe3765c2e82ab2d68922df57..7523971e37d9c0672bc09062d38522eb5803d241 100644 (file)
@@ -775,7 +775,8 @@ static int unpack_pdb(struct aa_ext *e, struct aa_policydb **policy,
                }
        }
 
-       if (pdb->perms && version <= 2) {
+       /* accept2 is in some cases being allocated, even with perms */
+       if (pdb->perms && !pdb->dfa->tables[YYTD_ID_ACCEPT2]) {
                /* add dfa flags table missing in v2 */
                u32 noents = pdb->dfa->tables[YYTD_ID_ACCEPT]->td_lolen;
                u16 tdflags = pdb->dfa->tables[YYTD_ID_ACCEPT]->td_flags;