From e5824af1f11bdb059a8f38800ad9bc965b0d8be4 Mon Sep 17 00:00:00 2001 From: chao liu Date: Tue, 11 Mar 2025 08:51:19 +0900 Subject: [PATCH] apparmor: fix 'Do simple duplicate message elimination' BugLink: https://bugs.launchpad.net/bugs/2101915 [ Upstream commit 9b897132424fe76bf6c61f22f9cf12af7f1d1e6a ] Multiple profiles shared 'ent->caps', so some logs missed. Fixes: 0ed3b28ab8bf ("AppArmor: mediation of non file objects") Signed-off-by: chao liu Signed-off-by: John Johansen Signed-off-by: Sasha Levin Signed-off-by: Koichiro Den Signed-off-by: Stefan Bader --- security/apparmor/capability.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/apparmor/capability.c b/security/apparmor/capability.c index 7c0f66f1b297..c4a4adc3c29d 100644 --- a/security/apparmor/capability.c +++ b/security/apparmor/capability.c @@ -97,6 +97,8 @@ static int audit_caps(struct apparmor_audit_data *ad, struct aa_profile *profile return error; } else { aa_put_profile(ent->profile); + if (profile != ent->profile) + cap_clear(ent->caps); ent->profile = aa_get_profile(profile); cap_raise(ent->caps, cap); }