diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-07-19 04:48:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:45 -0400 |
commit | bdf4c48af20a3b0f01671799ace345e3d49576da (patch) | |
tree | 7c3b903d2de1cba6e212ad6f347bc8742b08035a /fs/exec.c | |
parent | b111757c50ee30dad162192df6168e270a90c252 (diff) |
audit: rework execve audit
The purpose of audit_bprm() is to log the argv array to a userspace daemon at
the end of the execve system call. Since user-space hasn't had time to run,
this array is still in pristine state on the process' stack; so no need to
copy it, we can just grab it from there.
In order to minimize the damage to audit_log_*() copy each string into a
temporary kernel buffer first.
Currently the audit code requires that the full argument vector fits in a
single packet. So currently it does clip the argv size to a (sysctl) limit,
but only when execve auditing is enabled.
If the audit protocol gets extended to allow for multiple packets this check
can be removed.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ollie Wild <aaw@google.com>
Cc: <linux-audit@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1154,6 +1154,7 @@ int do_execve(char * filename, | |||
1154 | { | 1154 | { |
1155 | struct linux_binprm *bprm; | 1155 | struct linux_binprm *bprm; |
1156 | struct file *file; | 1156 | struct file *file; |
1157 | unsigned long env_p; | ||
1157 | int retval; | 1158 | int retval; |
1158 | int i; | 1159 | int i; |
1159 | 1160 | ||
@@ -1208,9 +1209,11 @@ int do_execve(char * filename, | |||
1208 | if (retval < 0) | 1209 | if (retval < 0) |
1209 | goto out; | 1210 | goto out; |
1210 | 1211 | ||
1212 | env_p = bprm->p; | ||
1211 | retval = copy_strings(bprm->argc, argv, bprm); | 1213 | retval = copy_strings(bprm->argc, argv, bprm); |
1212 | if (retval < 0) | 1214 | if (retval < 0) |
1213 | goto out; | 1215 | goto out; |
1216 | bprm->argv_len = env_p - bprm->p; | ||
1214 | 1217 | ||
1215 | retval = search_binary_handler(bprm,regs); | 1218 | retval = search_binary_handler(bprm,regs); |
1216 | if (retval >= 0) { | 1219 | if (retval >= 0) { |