linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <pmoore@redhat.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
	sgrubb@redhat.com, eparis@redhat.com
Subject: Re: [PATCH V4 (was V6)] audit: save signal match info in case entry passed in is the one deleted
Date: Tue, 04 Aug 2015 19:04:04 -0400	[thread overview]
Message-ID: <2901073.DtnZNkzh6Q@sifl> (raw)
In-Reply-To: <79ae63edcc644461001cd37b8ff1f9b1458f45f7.1438446636.git.rgb@redhat.com>

On Saturday, August 01, 2015 03:44:01 PM Richard Guy Briggs wrote:
> Move the access to the entry for audit_match_signal() to the beginning of
> the function in case the entry found is the same one passed in.  This will
> enable it to be used by audit_remove_mark_rule().
> 
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
>  kernel/auditfilter.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
> index 4cb9b44..afb63b3 100644
> --- a/kernel/auditfilter.c
> +++ b/kernel/auditfilter.c
> @@ -943,6 +943,7 @@ static inline int audit_del_rule(struct audit_entry
> *entry) int ret = 0;
>  #ifdef CONFIG_AUDITSYSCALL
>  	int dont_count = 0;
> +	int match_signal = !audit_match_signal(entry);
> 
>  	/* If either of these, don't count towards total */
>  	if (entry->rule.listnr == AUDIT_FILTER_USER ||
> @@ -972,7 +973,7 @@ static inline int audit_del_rule(struct audit_entry
> *entry) if (!dont_count)
>  		audit_n_rules--;
> 
> -	if (!audit_match_signal(entry))
> +	if (match_signal)
>  		audit_signals--;
>  #endif
>  	mutex_unlock(&audit_filter_mutex);

Why not simply move this second CONFIG_AUDITSYSCALL above the list_del() 
calls?  Am I missing something?

Also, while we're fixing up audit_del_rule(), why not also move the 
mutex_unlock() call to after the "out" jump target and then drop the 
mutex_unlock() call in the audit_find_rule() error case?  Not your fault, but 
the code seems silly as-is.

-- 
paul moore
security @ redhat

  reply	other threads:[~2015-08-04 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-01 19:44 [PATCH V4 (was V6)] generalize audit_del_rule Richard Guy Briggs
2015-08-01 19:44 ` [PATCH V4 (was V6)] audit: save signal match info in case entry passed in is the one deleted Richard Guy Briggs
2015-08-04 23:04   ` Paul Moore [this message]
2015-08-05  9:25     ` Richard Guy Briggs

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=2901073.DtnZNkzh6Q@sifl \
    --to=pmoore@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgb@redhat.com \
    --cc=sgrubb@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).