diff options
author | Yuichi Nakamura <ynakam@hitachisoft.jp> | 2007-11-10 05:21:34 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:57 -0500 |
commit | 1322b9def91ab8e9e673b58a64e13d6effaaa652 (patch) | |
tree | b52716f0d120f9d51b0cf32462c4f6f68d3c412b /arch/sh/kernel/ptrace_32.c | |
parent | 12760cb4df2a244efbaa262b32590af295c0b8e1 (diff) |
sh: syscall audit support.
Support syscall auditing..
Signed-off-by: Yuichi Nakamura <ynakam@hitachisoft.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/ptrace_32.c')
-rw-r--r-- | arch/sh/kernel/ptrace_32.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index ac725f0aeb72..ce0664a58b49 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * edited by Linus Torvalds | 6 | * edited by Linus Torvalds |
7 | * | 7 | * |
8 | * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka | 8 | * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka |
9 | * | 9 | * Audit support: Yuichi Nakamura <ynakam@hitachisoft.jp> |
10 | */ | 10 | */ |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/security.h> | 19 | #include <linux/security.h> |
20 | #include <linux/signal.h> | 20 | #include <linux/signal.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/audit.h> | ||
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
@@ -248,15 +249,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
248 | return ret; | 249 | return ret; |
249 | } | 250 | } |
250 | 251 | ||
251 | asmlinkage void do_syscall_trace(void) | 252 | asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) |
252 | { | 253 | { |
253 | struct task_struct *tsk = current; | 254 | struct task_struct *tsk = current; |
254 | 255 | ||
256 | if (unlikely(current->audit_context) && entryexit) | ||
257 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), | ||
258 | regs->regs[0]); | ||
259 | |||
255 | if (!test_thread_flag(TIF_SYSCALL_TRACE) && | 260 | if (!test_thread_flag(TIF_SYSCALL_TRACE) && |
256 | !test_thread_flag(TIF_SINGLESTEP)) | 261 | !test_thread_flag(TIF_SINGLESTEP)) |
257 | return; | 262 | goto out; |
258 | if (!(tsk->ptrace & PT_PTRACED)) | 263 | if (!(tsk->ptrace & PT_PTRACED)) |
259 | return; | 264 | goto out; |
265 | |||
260 | /* the 0x80 provides a way for the tracing parent to distinguish | 266 | /* the 0x80 provides a way for the tracing parent to distinguish |
261 | between a syscall stop and SIGTRAP delivery */ | 267 | between a syscall stop and SIGTRAP delivery */ |
262 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) && | 268 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) && |
@@ -271,4 +277,11 @@ asmlinkage void do_syscall_trace(void) | |||
271 | send_sig(tsk->exit_code, tsk, 1); | 277 | send_sig(tsk->exit_code, tsk, 1); |
272 | tsk->exit_code = 0; | 278 | tsk->exit_code = 0; |
273 | } | 279 | } |
280 | |||
281 | out: | ||
282 | if (unlikely(current->audit_context) && !entryexit) | ||
283 | audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3], | ||
284 | regs->regs[4], regs->regs[5], | ||
285 | regs->regs[6], regs->regs[7]); | ||
286 | |||
274 | } | 287 | } |