Skip to content

Commit

Permalink
parisc/ptrace: run seccomp after ptrace
Browse files Browse the repository at this point in the history
Close the hole where ptrace can change a syscall out from under seccomp.

Signed-off-by: Kees Cook <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: [email protected]
  • Loading branch information
kees committed Jun 14, 2016
1 parent 2ac3c8d commit 375f018
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arch/parisc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,

long do_syscall_trace_enter(struct pt_regs *regs)
{
/* Do the secure computing check first. */
if (secure_computing(NULL) == -1)
return -1;

if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs)) {
/*
Expand All @@ -325,6 +321,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
regs->gr[20] = -1UL;
goto out;
}

/* Do the secure computing check after ptrace. */
if (secure_computing(NULL) == -1)
return -1;

#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gr[20]);
Expand Down

0 comments on commit 375f018

Please sign in to comment.