All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: linux-audit@redhat.com
Subject: [PATCH 4/3] Audit: add argc and len fields for split records
Date: Tue, 09 Oct 2007 16:34:28 -0400	[thread overview]
Message-ID: <1191962068.3202.11.camel@localhost.localdomain> (raw)

To make it possible for userspace tools to verify that all of the args
were successfully logged add 2 new pieces of information to the execve
audit messages:

1) All messages now start with argc=%d before the logging of a0.  
2) When a single large argument is split into multiple records the first
of those records will now include a lenX=%d stating the number of bytes
in the original aX argument.

example:

record1: argc=2 a0=test_file
record2: len1=12k a1[0]=first 7.5k chunk of a1 argument
record3: a1[1]=remainder of a1 argument

Signed-off-by: Eric Paris <eparis@redhat.com>

 kernel/auditsc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index b411737..f8ac79b 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -836,6 +836,8 @@ static void audit_log_execve_info(struct audit_context *context,
 
 	p = (const char __user *)axi->mm->arg_start;
 
+	audit_log_format(*ab, "argc=%d ", axi->argc);
+
 	for (i = 0; i < axi->argc; i++, p += len) {
 		char tmp_buf[12];
 		/* how many digits are in i? */
@@ -888,6 +890,9 @@ static void audit_log_execve_info(struct audit_context *context,
 					kfree(buf);
 					return;
 				}
+				if (j == 0)
+					audit_log_format(*ab, "len%d=%ld ", i,
+							 len + tmplen);
 				audit_log_format(*ab, "a%d[%d]=", i, j);
 				audit_log_untrustedstring(*ab, buf);
 				audit_log_format(*ab, "\n");

             reply	other threads:[~2007-10-09 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 20:34 Eric Paris [this message]
2007-10-09 22:53 ` [PATCH 4/3] Audit: add argc and len fields for split records Linda Knippers

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=1191962068.3202.11.camel@localhost.localdomain \
    --to=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.