public inbox for linux-kernel@vger.kernel.org
 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, peter@hda3.com
Subject: Re: [PATCH V10] fixup! audit: add audit by children of executable path
Date: Mon, 10 Aug 2015 12:27:15 -0400	[thread overview]
Message-ID: <3269736.cyCpyM8Kln@sifl> (raw)
In-Reply-To: <5d3a6285b9302c3f579e15b589603eb2347ee5c8.1439036885.git.rgb@redhat.com>

On Saturday, August 08, 2015 10:23:48 AM Richard Guy Briggs wrote:
> Adding "C=1 CF=-D__CHECK_ENDIAN__" to enable sparse warnings identified a
> warning with the
> 	[PATCH V9 3/3] audit: add audit by children of executable path
> patch posted a couple of days ago (and just re-posted due to another fix):
> 
> kernel/auditsc.c:476:46: warning: dereference of noderef expression
> kernel/auditsc.c:477:61: warning: dereference of noderef expression
> 
> task_struct->parent requires RCU locking for access.  This fix resolves the
> two warnings.
> 
> This patch should be merged with the patch it fixes once the fix is
> confirmed to be the correct approach since the original patch hasn't been
> accepted yet.
> 
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
> My hesitation is that the rcu lock scope is too broad.  If the loop were
> re-structured to hold the rcu_read_lock() and call rcu_dereference() once
> per iteration, would lock release and retake action cause more overhead?
> 
>  kernel/auditsc.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)

I'm still not convinced that we need to merge exe child filtering patch so I'm 
not going to apply this, or your v10 patch, at this point in time.  If you 
want to hold on to the code in case you and/or Steve think you can convince me 
at a later date, you might as well merge this fixup patch into the v10 patch.

> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index e1f0da2..3ed043d 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -473,13 +473,16 @@ static int audit_filter_rules(struct task_struct *tsk,
> {
>  			struct task_struct *ptsk;
> 
> -			for (ptsk = tsk; ptsk->parent->pid > 0;
> -			     ptsk = find_task_by_pid_ns(ptsk->parent->pid, &init_pid_ns)) {
> +			rcu_read_lock();
> +			for (ptsk = tsk; rcu_dereference(ptsk->parent)->pid > 0;
> +			     ptsk = find_task_by_pid_ns(rcu_dereference(ptsk->parent)->pid
> +							, &init_pid_ns)) {
>  				if (audit_exe_compare(ptsk, rule->exe)) {
>  					++result;
>  					break;
>  				}
>  			}
> +			rcu_read_unlock();
>  		}
>  			break;
>  		case AUDIT_UID:

-- 
paul moore
security @ redhat


  reply	other threads:[~2015-08-10 16:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08 14:23 [PATCH V10] fixup! audit: add audit by children of executable path Richard Guy Briggs
2015-08-10 16:27 ` Paul Moore [this message]
2015-08-10 16:53   ` Richard Guy Briggs
2015-08-10 18:45     ` Paul Moore

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=3269736.cyCpyM8Kln@sifl \
    --to=pmoore@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hda3.com \
    --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