From 8af5a9038bfff4dc99506a897699e7f79add027b Mon Sep 17 00:00:00 2001 From: weishu Date: Sun, 4 Jun 2023 13:59:14 +0800 Subject: [PATCH] kernel: fix set app profile may override other user's --- kernel/allowlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/allowlist.c b/kernel/allowlist.c index b84a0037..87669e32 100644 --- a/kernel/allowlist.c +++ b/kernel/allowlist.c @@ -109,7 +109,9 @@ bool ksu_set_app_profile(struct app_profile *profile, bool persist) list_for_each (pos, &allow_list) { p = list_entry(pos, struct perm_data, list); - if (!strcmp(profile->key, p->profile.key)) { + // both uid and package must match, otherwise it will break multiple package with different user id + if (profile->current_uid == p->profile.current_uid && + !strcmp(profile->key, p->profile.key)) { // found it, just override it all! memcpy(&p->profile, profile, sizeof(*profile)); result = true;