Browse Source

MIPS: ptrace: Move away from secure_computing_strict

MIPS now has the infrastructure for dynamic seccomp-bpf
filtering

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6400/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Markos Chandras 11 years ago
parent
commit
1225eb8252
2 changed files with 7 additions and 5 deletions
  1. 1 1
      arch/mips/include/asm/ptrace.h
  2. 6 4
      arch/mips/kernel/ptrace.c

+ 1 - 1
arch/mips/include/asm/ptrace.h

@@ -82,7 +82,7 @@ static inline long regs_return_value(struct pt_regs *regs)
 #define instruction_pointer(regs) ((regs)->cp0_epc)
 #define instruction_pointer(regs) ((regs)->cp0_epc)
 #define profile_pc(regs) instruction_pointer(regs)
 #define profile_pc(regs) instruction_pointer(regs)
 
 
-extern asmlinkage void syscall_trace_enter(struct pt_regs *regs);
+extern asmlinkage long syscall_trace_enter(struct pt_regs *regs);
 extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
 extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
 
 
 extern void die(const char *, struct pt_regs *) __noreturn;
 extern void die(const char *, struct pt_regs *) __noreturn;

+ 6 - 4
arch/mips/kernel/ptrace.c

@@ -662,13 +662,14 @@ long arch_ptrace(struct task_struct *child, long request,
  * Notification of system call entry/exit
  * Notification of system call entry/exit
  * - triggered by current->work.syscall_trace
  * - triggered by current->work.syscall_trace
  */
  */
-asmlinkage void syscall_trace_enter(struct pt_regs *regs)
+asmlinkage long syscall_trace_enter(struct pt_regs *regs)
 {
 {
+	long syscall = regs->regs[2];
 	long ret = 0;
 	long ret = 0;
 	user_exit();
 	user_exit();
 
 
-	/* do the secure computing check first */
-	secure_computing_strict(regs->regs[2]);
+	if (secure_computing(syscall) == -1)
+		return -1;
 
 
 	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
 	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
 	    tracehook_report_syscall_entry(regs))
 	    tracehook_report_syscall_entry(regs))
@@ -678,9 +679,10 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
 		trace_sys_enter(regs, regs->regs[2]);
 		trace_sys_enter(regs, regs->regs[2]);
 
 
 	audit_syscall_entry(syscall_get_arch(current, regs),
 	audit_syscall_entry(syscall_get_arch(current, regs),
-			    regs->regs[2],
+			    syscall,
 			    regs->regs[4], regs->regs[5],
 			    regs->regs[4], regs->regs[5],
 			    regs->regs[6], regs->regs[7]);
 			    regs->regs[6], regs->regs[7]);
+	return syscall;
 }
 }
 
 
 /*
 /*