From f60122191388a67ddd5236e439e500aefd06a418 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Sun, 29 Jan 2023 02:13:56 -0800 Subject: [PATCH] UBUNTU: SAUCE: apparmor4.0.0 [76/90]: apparmor: switch signal mediation to using RULE_MEDIATES BugLink: http://bugs.launchpad.net/bugs/2028253 Currently signal mediation is using a hard coded form of the RULE_MEDIATES check. This means it won't atomatically pickup any changes or improvements in the check. Switch to using RULE_MEDIATES. Signed-off-by: John Johansen (cherry picked from commit dfef56d8135636988a8a3bfc98d3887446993993 https://git.launchpad.net/~apparmor-dev/ubuntu-kernel-next) Signed-off-by: Paolo Pisati --- security/apparmor/ipc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c index 35a9b02f026a..099ce3130063 100644 --- a/security/apparmor/ipc.c +++ b/security/apparmor/ipc.c @@ -88,16 +88,16 @@ static int profile_signal_perm(const struct cred *cred, struct aa_perms perms; aa_state_t state; - if (profile_unconfined(profile) || - !ANY_RULE_MEDIATES(&profile->rules, AA_CLASS_SIGNAL)) + if (profile_unconfined(profile)) return 0; ad->subj_cred = cred; ad->peer = peer; /* TODO: secondary cache check */ - state = aa_dfa_next(rules->policy->dfa, - rules->policy->start[AA_CLASS_SIGNAL], - ad->signal); + state = RULE_MEDIATES(rules, AA_CLASS_SIGNAL); + if (!state) + return 0; + state = aa_dfa_next(rules->policy->dfa, state, ad->signal); aa_label_match(profile, rules, peer, state, false, request, &perms); aa_apply_modes_to_perms(profile, &perms); return aa_check_perms(profile, &perms, request, ad, audit_signal_cb);