AA_BUG(!profile);
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
state = aa_match_to_prot(rules->policy, state, AA_MAY_CREATE,
PF_UNIX, type, protocol, NULL,
AA_BUG(is_unix_fs(sk));
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
state = match_to_sk(rules->policy, state, request, unix_sk(sk),
&p, &ad->info);
AA_BUG(!ad);
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
/* bind for abstract socket */
state = match_to_local(rules->policy, state, AA_MAY_BIND,
AA_BUG(!ad);
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
__be16 b = cpu_to_be16(backlog);
AA_BUG(!ad);
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
state = match_to_sk(rules->policy, state, AA_MAY_ACCEPT,
unix_sk(sk), &p, &ad->info);
AA_BUG(!ad);
AA_BUG(profile_unconfined(profile));
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
__be16 b = cpu_to_be16(optname);
AA_BUG(!ad);
AA_BUG(is_unix_fs(peer_sk)); /* currently always calls unix_fs_perm */
- state = RULE_MEDIATES_NET(rules);
+ state = RULE_MEDIATES_v9NET(rules);
if (state) {
struct aa_sk_ctx *peer_ctx = aa_sock(peer_sk);
struct aa_profile *peerp;
AA_SFS_DIR("domain", aa_sfs_entry_domain),
AA_SFS_DIR("file", aa_sfs_entry_file),
AA_SFS_DIR("network_v8", aa_sfs_entry_network),
- AA_SFS_DIR("network", aa_sfs_entry_networkv9),
+ AA_SFS_DIR("network_v9", aa_sfs_entry_networkv9),
AA_SFS_DIR("mount", aa_sfs_entry_mount),
AA_SFS_DIR("namespaces", aa_sfs_entry_ns),
AA_SFS_FILE_U64("capability", VFS_CAP_FLAGS_MASK),
rules->policy->start[0], &class, 1);
}
+static inline aa_state_t RULE_MEDIATES_v9NET(struct aa_ruleset *rules)
+{
+ return RULE_MEDIATES(rules, AA_CLASS_NETV9);
+}
+
static inline aa_state_t RULE_MEDIATES_NET(struct aa_ruleset *rules)
{
- return RULE_MEDIATES(rules, AA_CLASS_NET);
+ /* can not use RULE_MEDIATE_v9AF here, because AF match fail
+ * can not be distiguished from class match fail, and we only
+ * fallback to checking older class on class match failure
+ */
+ aa_state_t state = RULE_MEDIATES(rules, AA_CLASS_NETV9);
+
+ /* fallback and check v7/8 if v9 is NOT mediated */
+ if (!state)
+ state = RULE_MEDIATES(rules, AA_CLASS_NET);
+
+ return state;
}
+
static inline aa_state_t ANY_RULE_MEDIATES(struct list_head *head,
unsigned char class)
{