]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
apparmor: Fix regression in compat permissions for getattr
authorJohn Johansen <john.johansen@canonical.com>
Wed, 15 Feb 2023 04:21:17 +0000 (20:21 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Wed, 15 Feb 2023 19:24:38 +0000 (11:24 -0800)
commitcbb13e12a5d3ecef400716ea7d12a9268b0f37ca
tree8c366e29f297868d52f4da45d688a1758499b975
parente1c04510f521e853019afeca2a5991a5ef8d6a5b
apparmor: Fix regression in compat permissions for getattr

This fixes a regression in mediation of getattr when old policy built
under an older ABI is loaded and mapped to internal permissions.

The regression does not occur for all getattr permission requests,
only appearing if state zero is the final state in the permission
lookup.  This is because despite the first state (index 0) being
guaranteed to not have permissions in both newer and older permission
formats, it may have to carry permissions that were not mediated as
part of an older policy. These backward compat permissions are
mapped here to avoid special casing the mediation code paths.

Since the mapping code already takes into account backwards compat
permission from older formats it can be applied to state 0 to fix
the regression.

Fixes: 408d53e923bd ("apparmor: compute file permissions on profile load")
Reported-by: Philip Meulengracht <the_meulengracht@hotmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_compat.c