All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Viro <aviro@redhat.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com, David Woodhouse <dwmw2@redhat.com>
Subject: Re: [PATCH] -V2 Allow ppid filtering on syscall auditing
Date: Fri, 29 Sep 2006 00:08:50 -0400	[thread overview]
Message-ID: <20060929040850.GE17710@devserv.devel.redhat.com> (raw)
In-Reply-To: <1159473786.3228.138.camel@localhost.localdomain>

On Thu, Sep 28, 2006 at 04:03:06PM -0400, Eric Paris wrote:
> 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.
  
> @@ -1116,6 +1115,7 @@ void audit_syscall_entry(int arch, int m
>  
>  	context->arch	    = arch;
>  	context->major      = major;
> +	context->ppid       = sys_getppid();

Ehh...  That's one hell of an overhead to be had ;-/  How about this?

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fb83c5c..fd77ce4 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -278,8 +278,11 @@ static int audit_filter_rules(struct tas
 			result = audit_comparator(tsk->pid, f->op, f->val);
 			break;
 		case AUDIT_PPID:
-			if (ctx)
+			if (ctx) {
+				if (!ctx->ppid)
+					ctx->ppid = sys_getppid();
 				result = audit_comparator(ctx->ppid, f->op, f->val);
+			}
 			break;
 		case AUDIT_UID:
 			result = audit_comparator(tsk->uid, f->op, f->val);
@@ -795,7 +798,8 @@ static void audit_log_exit(struct audit_
 
 	/* tsk == current */
 	context->pid = tsk->pid;
-	context->ppid = sys_getppid();	/* sic.  tsk == current in all cases */
+	if (!context->ppid)
+		context->ppid = sys_getppid();
 	context->uid = tsk->uid;
 	context->gid = tsk->gid;
 	context->euid = tsk->euid;
@@ -1132,6 +1136,7 @@ #endif
 	context->ctime      = CURRENT_TIME;
 	context->in_syscall = 1;
 	context->auditable  = !!(state == AUDIT_RECORD_CONTEXT);
+	context->ppid       = 0;
 }
 
 /**

      reply	other threads:[~2006-09-29  4:08 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   ` [PATCH] -V2 " Eric Paris
2006-09-29  4:08     ` Alexander Viro [this message]

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=20060929040850.GE17710@devserv.devel.redhat.com \
    --to=aviro@redhat.com \
    --cc=dwmw2@redhat.com \
    --cc=eparis@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.