From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Steve Grubb <sgrubb@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-audit@redhat.com, aaw@google.com
Subject: [PATCH] audit: fix two bugs in the new execve audit code
Date: Sat, 28 Jul 2007 00:55:18 +0200 [thread overview]
Message-ID: <1185576918.15205.68.camel@lappy> (raw)
In-Reply-To: <200707271613.10753.sgrubb@redhat.com>
On Fri, 2007-07-27 at 16:13 -0400, Steve Grubb wrote:
> Hi,
>
> I was testing our rawhide kernel and I'm scrolling these errors:
>
> WARNING: at kernel/auditsc.c:859 audit_log_execve_info() (Not tainted)
>
> Call Trace:
> [<ffffffff8106b06f>] audit_log_exit+0x5d7/0x964
> [<ffffffff81050805>] trace_hardirqs_on+0x12e/0x151
> [<ffffffff8106b60b>] audit_syscall_exit+0x9b/0x300
> [<ffffffff8100ee62>] syscall_trace_leave+0x2c/0x87
> [<ffffffff8100beb1>] int_very_careful+0x3a/0x43
>
--
copy_from_user() returns the number of bytes not copied, hence 0 is the
expected output.
axi->mm might not be valid anymore when not equal to current->mm, do not
dereference before checking that - thanks to Al for spotting that.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/auditsc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6/kernel/auditsc.c
===================================================================
--- linux-2.6.orig/kernel/auditsc.c
+++ linux-2.6/kernel/auditsc.c
@@ -824,12 +824,14 @@ static void audit_log_execve_info(struct
{
int i;
long len, ret;
- const char __user *p = (const char __user *)axi->mm->arg_start;
+ const char __user *p;
char *buf;
if (axi->mm != current->mm)
return; /* execve failed, no additional info */
+ p = (const char __user *)axi->mm->arg_start;
+
for (i = 0; i < axi->argc; i++, p += len) {
len = strnlen_user(p, MAX_ARG_STRLEN);
/*
@@ -855,7 +857,7 @@ static void audit_log_execve_info(struct
* copied them here, and the mm hasn't been exposed to user-
* space yet.
*/
- if (!ret) {
+ if (ret) {
WARN_ON(1);
send_sig(SIGKILL, current, 0);
}
next prev parent reply other threads:[~2007-07-27 22:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-19 8:48 [patch 058/209] audit: rework execve audit akpm
2007-07-27 20:13 ` Steve Grubb
2007-07-27 20:44 ` Peter Zijlstra
2007-07-27 20:57 ` Steve Grubb
2007-07-27 21:55 ` Peter Zijlstra
2007-07-27 22:06 ` Peter Zijlstra
2007-07-27 22:24 ` Peter Zijlstra
2007-07-27 20:50 ` Alexander Viro
2007-07-27 21:03 ` Alexander Viro
2007-07-27 21:11 ` Steve Grubb
2007-07-27 21:21 ` Alexander Viro
2007-07-27 22:55 ` Peter Zijlstra [this message]
2007-07-27 23:05 ` [PATCH] audit: fix two bugs in the new execve audit code Andrew Morton
2007-07-28 2:05 ` Steve Grubb
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=1185576918.15205.68.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=aaw@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-audit@redhat.com \
--cc=sgrubb@redhat.com \
--cc=torvalds@linux-foundation.org \
/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