Skip to content

Commit b9590ad

Browse files
committed
apparmor: remove POLICY_MEDIATES_SAFE
The unpack code now makes sure every profile has a dfa so the safe version of POLICY_MEDIATES is no longer needed. Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 56974a6 commit b9590ad

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

‎security/apparmor/apparmorfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ static void profile_query_cb(struct aa_profile *profile, struct aa_perms *perms,
619619
tmp = aa_compute_fperms(dfa, state, &cond);
620620
}
621621
} else if (profile->policy.dfa) {
622-
if (!PROFILE_MEDIATES_SAFE(profile, *match_str))
622+
if (!PROFILE_MEDIATES(profile, *match_str))
623623
return; /* no change to current perms */
624624
dfa = profile->policy.dfa;
625625
state = aa_dfa_match_len(dfa, profile->policy.start[0],

‎security/apparmor/include/policy.h‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,7 @@ static inline struct aa_profile *aa_get_newest_profile(struct aa_profile *p)
214214
return labels_profile(aa_get_newest_label(&p->label));
215215
}
216216

217-
#define PROFILE_MEDIATES(P, T) ((P)->policy.start[(T)])
218-
/* safe version of POLICY_MEDIATES for full range input */
219-
static inline unsigned int PROFILE_MEDIATES_SAFE(struct aa_profile *profile,
220-
unsigned char class)
221-
{
222-
if (profile->policy.dfa)
223-
return aa_dfa_match_len(profile->policy.dfa,
224-
profile->policy.start[0], &class, 1);
225-
return 0;
226-
}
227-
217+
#define PROFILE_MEDIATES(P, T) ((P)->policy.start[(unsigned char) (T)])
228218
static inline unsigned int PROFILE_MEDIATES_AF(struct aa_profile *profile,
229219
u16 AF) {
230220
unsigned int state = PROFILE_MEDIATES(profile, AA_CLASS_NET);

0 commit comments

Comments
 (0)