函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:security\apparmor\label.c Create Date:2022-07-27 21:45:06
首页 Copyright©Brick

1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
/* match a profile and its associated ns component if needed
 * Assumes visibility test has already been done.
 * If a subns profile is not to be matched should be prescreened with
 * visibility test.
 */
static inline unsigned int match_component(struct aa_profile *profile,
                       struct aa_profile *tp,
                       unsigned int state)
{
    const char *ns_name;
 
    if (profile->ns == tp->ns)
        return aa_dfa_match(profile->policy.dfa, state, tp->base.hname);
 
    /* try matching with namespace name and then profile */
    ns_name = aa_ns_name(profile->ns, tp->ns, true);
    state = aa_dfa_match_len(profile->policy.dfa, state, ":", 1);
    state = aa_dfa_match(profile->policy.dfa, state, ns_name);
    state = aa_dfa_match_len(profile->policy.dfa, state, ":", 1);
    return aa_dfa_match(profile->policy.dfa, state, tp->base.hname);
}