Skip to content

Commit 2504db2

Browse files
committed
apparmor: fix overlapping attachment computation
When finding the profile via patterned attachments, the longest left match is being set to the static compile time value and not using the runtime computed value. Fix this by setting the candidate value to the greater of the precomputed value or runtime computed value. Fixes: 21f6066 ("apparmor: improve overlapping domain attachment resolution") Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 3bbb7b2 commit 2504db2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

security/apparmor/domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static struct aa_label *find_attach(const struct linux_binprm *bprm,
466466
* xattrs, or a longer match
467467
*/
468468
candidate = profile;
469-
candidate_len = profile->xmatch_len;
469+
candidate_len = max(count, profile->xmatch_len);
470470
candidate_xattrs = ret;
471471
conflict = false;
472472
}

security/apparmor/include/policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct aa_profile {
135135

136136
const char *attach;
137137
struct aa_dfa *xmatch;
138-
int xmatch_len;
138+
unsigned int xmatch_len;
139139
enum audit_mode audit;
140140
long mode;
141141
u32 path_flags;

0 commit comments

Comments
 (0)