Skip to content

Commit cbb13e1

Browse files
committed
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: 408d53e ("apparmor: compute file permissions on profile load") Reported-by: Philip Meulengracht <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent e1c0451 commit cbb13e1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

security/apparmor/policy_compat.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ static struct aa_perms *compute_fperms(struct aa_dfa *dfa)
160160
if (!table)
161161
return NULL;
162162

163-
/* zero init so skip the trap state (state == 0) */
164-
for (state = 1; state < state_count; state++) {
163+
for (state = 0; state < state_count; state++) {
165164
table[state * 2] = compute_fperms_user(dfa, state);
166165
table[state * 2 + 1] = compute_fperms_other(dfa, state);
167166
}

0 commit comments

Comments
 (0)