Skip to content

Commit db93ca1

Browse files
rlee287jrjohansen
authored andcommitted
apparmor: properly handle cx/px lookup failure for complain
mode profiles When a cx/px lookup fails, apparmor would deny execution of the binary even in complain mode (where it would audit as allowing execution while actually denying it). Instead, in complain mode, create a new learning profile, just as would have been done if the cx/px line wasn't there. Signed-off-by: Ryan Lee <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 17d0d04 commit db93ca1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

security/apparmor/domain.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,17 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
680680
/* hack ix fallback - improve how this is detected */
681681
goto audit;
682682
} else if (!new) {
683-
error = -EACCES;
684683
info = "profile transition not found";
685-
/* remove MAY_EXEC to audit as failure */
684+
/* remove MAY_EXEC to audit as failure or complaint */
686685
perms.allow &= ~MAY_EXEC;
686+
if (COMPLAIN_MODE(profile)) {
687+
/* create null profile instead of failing */
688+
goto create_learning_profile;
689+
}
690+
error = -EACCES;
687691
}
688692
} else if (COMPLAIN_MODE(profile)) {
693+
create_learning_profile:
689694
/* no exec permission - learning mode */
690695
struct aa_profile *new_profile = NULL;
691696

0 commit comments

Comments
 (0)