public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/15] fixing audit rule ordering mess, part 1
Date: Wed, 17 Dec 2008 13:28:08 -0500	[thread overview]
Message-ID: <1229538488.3384.33.camel@localhost.localdomain> (raw)
In-Reply-To: <E1LCoiI-0000Eu-Ty@ZenIV.linux.org.uk>

On Wed, 2008-12-17 at 05:12 +0000, Al Viro wrote:
> Problem: ordering between the rules on exit chain is currently lost;
> all watch and inode rules are listed after everything else _and_
> exit,never on one kind doesn't stop exit,always on another from
> being matched.
> 
> Solution: assign priorities to rules, keep track of the current
> highest-priority matching rule and its result (always/never).
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


> @@ -1258,6 +1258,9 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,
>  	return ret;
>  }
>  
> +static u64 prio_low = ~0ULL/2;
> +static u64 prio_high = ~0ULL/2 - 1;
> +
>  /* Add rule to given filterlist if not a duplicate. */
>  static inline int audit_add_rule(struct audit_entry *entry,
>  				 struct list_head *list)
> @@ -1319,6 +1322,14 @@ static inline int audit_add_rule(struct audit_entry *entry,
>  		}
>  	}
>  
> +	entry->rule.prio = ~0ULL;
> +	if (entry->rule.listnr == AUDIT_FILTER_EXIT) {
> +		if (entry->rule.flags & AUDIT_FILTER_PREPEND)
> +			entry->rule.prio = ++prio_high;
> +		else
> +			entry->rule.prio = --prio_low;
> +	}
> +
>  	if (entry->rule.flags & AUDIT_FILTER_PREPEND) {
>  		list_add_rcu(&entry->list, list);

I don't see why prio is only important on AUDIT_FILTER_EXIT.  Couldn't I
end up with stupidity with entry,never  ?

-Eric


  parent reply	other threads:[~2008-12-17 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17  5:12 [PATCH 11/15] fixing audit rule ordering mess, part 1 Al Viro
2008-12-17  7:48 ` James Morris
2008-12-17 18:28 ` Eric Paris [this message]
2008-12-17 20:59   ` Al Viro
2008-12-17 21:10     ` Eric Paris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229538488.3384.33.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox