Skip to content

Commit 483bb5c

Browse files
jrjohansenopsiff
authored andcommitted
apparmor: provide separate audit messages for file and policy checks
[ Upstream commit 75c77e9 ] Improve policy load failure messages by identifying which dfa the verification check failed in. Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Stable-dep-of: a4c9efa4dbad ("apparmor: make label_match return a consistent value") Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit f89b657e17855c7775db36360d5e2cc1198b0b5a) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 25d60ba commit 483bb5c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

security/apparmor/policy_unpack.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,12 +1249,18 @@ static int verify_profile(struct aa_profile *profile)
12491249
if (!rules)
12501250
return 0;
12511251

1252-
if ((rules->file.dfa && !verify_dfa_accept_index(rules->file.dfa,
1253-
rules->file.size)) ||
1254-
(rules->policy.dfa &&
1255-
!verify_dfa_accept_index(rules->policy.dfa, rules->policy.size))) {
1252+
if (rules->file.dfa && !verify_dfa_accept_index(rules->file.dfa,
1253+
rules->file.size)) {
12561254
audit_iface(profile, NULL, NULL,
1257-
"Unpack: Invalid named transition", NULL, -EPROTO);
1255+
"Unpack: file Invalid named transition", NULL,
1256+
-EPROTO);
1257+
return -EPROTO;
1258+
}
1259+
if (rules->policy.dfa &&
1260+
!verify_dfa_accept_index(rules->policy.dfa, rules->policy.size)) {
1261+
audit_iface(profile, NULL, NULL,
1262+
"Unpack: policy Invalid named transition", NULL,
1263+
-EPROTO);
12581264
return -EPROTO;
12591265
}
12601266

0 commit comments

Comments
 (0)