public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Linda Knippers <linda.knippers@hp.com>
Cc: linux-audit@redhat.com, David Woodhouse <dwmw2@redhat.com>
Subject: [PATCH] -V2 Allow ppid filtering on syscall auditing
Date: Thu, 28 Sep 2006 16:03:06 -0400	[thread overview]
Message-ID: <1159473786.3228.138.camel@localhost.localdomain> (raw)
In-Reply-To: <451B34D4.90607@hp.com>

Currently ppid filtering on syscall auditing does not appear to work. An
easy reproducer would be to do the following:

touch ./test
auditctl -a entry,always -S chmod -F ppid=[pid of your shell]
chmod 000 ./test

no audit record will appear! (although !=[pid of your shell] will show
all chmod commands from all processes regardless of the ppid)

With a little instrumentation I found that ctx->ppid == 0 inside
audit_filter_rules().  I originally wanted to set the ppid during the
context creation back in something like audit_alloc_context but that
didn't work.  Because at that point the new process had not forked off
so the ppid of the chmod process was actually it's parents parents.
Instead I set the ppid in  audit_syscall_entry when we are actually
building the specific context.

After some looking I did not see a way to get into audit_log_exit
without having set the ppid.  So I am dropping the set from there and
only doing it at the beginning.

Please comment/ack/nak as soon as possible.
 
-Eric

 kernel/auditsc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.18.i686/kernel/auditsc.c.orig	2006-09-27 21:53:44.000000000 -0400
+++ linux-2.6.18.i686/kernel/auditsc.c	2006-09-28 15:51:44.000000000 -0400
@@ -795,7 +795,6 @@ static void audit_log_exit(struct audit_
 
 	/* tsk == current */
 	context->pid = tsk->pid;
-	context->ppid = sys_getppid();	/* sic.  tsk == current in all cases */
 	context->uid = tsk->uid;
 	context->gid = tsk->gid;
 	context->euid = tsk->euid;
@@ -1116,6 +1115,7 @@ void audit_syscall_entry(int arch, int m
 
 	context->arch	    = arch;
 	context->major      = major;
+	context->ppid       = sys_getppid();
 	context->argv[0]    = a1;
 	context->argv[1]    = a2;
 	context->argv[2]    = a3;

  reply	other threads:[~2006-09-28 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-28  2:10 [PATCH] Allow ppid filtering on syscall auditing Eric Paris
2006-09-28  2:35 ` Linda Knippers
2006-09-28 20:03   ` Eric Paris [this message]
2006-09-29  4:08     ` [PATCH] -V2 " Alexander Viro

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=1159473786.3228.138.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=dwmw2@redhat.com \
    --cc=linda.knippers@hp.com \
    --cc=linux-audit@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