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: 21f6066105 ("apparmor: improve overlapping domain attachment resolution")
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2022-03-26 01:58:15 -07:00
Родитель 3bbb7b2e9b
Коммит 2504db2071
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -466,7 +466,7 @@ restart:
* xattrs, or a longer match
*/
candidate = profile;
candidate_len = profile->xmatch_len;
candidate_len = max(count, profile->xmatch_len);
candidate_xattrs = ret;
conflict = false;
}

Просмотреть файл

@ -135,7 +135,7 @@ struct aa_profile {
const char *attach;
struct aa_dfa *xmatch;
int xmatch_len;
unsigned int xmatch_len;
enum audit_mode audit;
long mode;
u32 path_flags;