aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/kernel/entry-common.S8
-rw-r--r--arch/sh/kernel/ptrace_32.c21
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--init/Kconfig2
4 files changed, 26 insertions, 7 deletions
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index e0317ed080c..397ac71d97f 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -224,7 +224,7 @@ work_resched:
224syscall_exit_work: 224syscall_exit_work:
225 ! r0: current_thread_info->flags 225 ! r0: current_thread_info->flags
226 ! r8: current_thread_info 226 ! r8: current_thread_info
227 tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP, r0 227 tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT, r0
228 bt/s work_pending 228 bt/s work_pending
229 tst #_TIF_NEED_RESCHED, r0 229 tst #_TIF_NEED_RESCHED, r0
230#ifdef CONFIG_TRACE_IRQFLAGS 230#ifdef CONFIG_TRACE_IRQFLAGS
@@ -234,6 +234,8 @@ syscall_exit_work:
234#endif 234#endif
235 sti 235 sti
236 ! XXX setup arguments... 236 ! XXX setup arguments...
237 mov r15, r4
238 mov #1, r5
237 mov.l 4f, r0 ! do_syscall_trace 239 mov.l 4f, r0 ! do_syscall_trace
238 jsr @r0 240 jsr @r0
239 nop 241 nop
@@ -244,6 +246,8 @@ syscall_exit_work:
244syscall_trace_entry: 246syscall_trace_entry:
245 ! Yes it is traced. 247 ! Yes it is traced.
246 ! XXX setup arguments... 248 ! XXX setup arguments...
249 mov r15, r4
250 mov #0, r5
247 mov.l 4f, r11 ! Call do_syscall_trace which notifies 251 mov.l 4f, r11 ! Call do_syscall_trace which notifies
248 jsr @r11 ! superior (will chomp R[0-7]) 252 jsr @r11 ! superior (will chomp R[0-7])
249 nop 253 nop
@@ -366,7 +370,7 @@ ENTRY(system_call)
366 ! 370 !
367 get_current_thread_info r8, r10 371 get_current_thread_info r8, r10
368 mov.l @(TI_FLAGS,r8), r8 372 mov.l @(TI_FLAGS,r8), r8
369 mov #_TIF_SYSCALL_TRACE, r10 373 mov #(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT), r10
370 tst r10, r8 374 tst r10, r8
371 bf syscall_trace_entry 375 bf syscall_trace_entry
372 ! 376 !
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index ac725f0aeb7..ce0664a58b4 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
251asmlinkage void do_syscall_trace(void) 252asmlinkage 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
281out:
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}
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index d49ee9d868e..c6577d3dc46 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -113,6 +113,7 @@ static inline struct thread_info *current_thread_info(void)
113#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 113#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
114#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */ 114#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */
115#define TIF_SINGLESTEP 4 /* singlestepping active */ 115#define TIF_SINGLESTEP 4 /* singlestepping active */
116#define TIF_SYSCALL_AUDIT 5
116#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
117#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
118#define TIF_MEMDIE 18 119#define TIF_MEMDIE 18
@@ -123,6 +124,7 @@ static inline struct thread_info *current_thread_info(void)
123#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 124#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
124#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 125#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
125#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 126#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
127#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
126#define _TIF_USEDFPU (1<<TIF_USEDFPU) 128#define _TIF_USEDFPU (1<<TIF_USEDFPU)
127#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 129#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
128#define _TIF_FREEZE (1<<TIF_FREEZE) 130#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/init/Kconfig b/init/Kconfig
index 0eda68f0ad5..288444b4cd8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -238,7 +238,7 @@ config AUDIT
238 238
239config AUDITSYSCALL 239config AUDITSYSCALL
240 bool "Enable system-call auditing support" 240 bool "Enable system-call auditing support"
241 depends on AUDIT && (X86 || PPC || PPC64 || S390 || IA64 || UML || SPARC64) 241 depends on AUDIT && (X86 || PPC || PPC64 || S390 || IA64 || UML || SPARC64|| SUPERH)
242 default y if SECURITY_SELINUX 242 default y if SECURITY_SELINUX
243 help 243 help
244 Enable low-overhead system-call auditing infrastructure that 244 Enable low-overhead system-call auditing infrastructure that