Re: [PATCH 2/4] arch/arm: move secure_computing into trace

From: Will Deacon
Date: Fri Nov 09 2012 - 06:56:04 EST


One really minor nit...

On Thu, Nov 08, 2012 at 08:59:31PM +0000, Kees Cook wrote:
> There is very little difference in the TIF_SECCOMP and TIF_SYSCALL_WORK
> path in entry-common.S, so merge TIF_SECCOMP into TIF_SYSCALL_WORK and
> move seccomp into the syscall_trace_enter() handler.
>
> Expanded some of the tracehook logic into the callers to make this code
> more readable. Since tracehook needs to do register changing, this portion
> is best left in its own function instead of copy/pasting into the callers.
>
> Additionally, the return value for secure_computing() is now checked
> and a -1 value will result in the system call being skipped.
>
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

[...]

> @@ -944,19 +939,39 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
>
> asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
> {
> - scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
> + current_thread_info()->syscall = scno;
> +
> + /* do the secure computing check first */
> + if (secure_computing(scno) == -1) {
> + /* seccomp failures shouldn't expose any additional code. */
> + scno = -1;
> + goto out;
> + }

Can we just return -1 here instead please? The whole jump label code makes
this code messier than it needs to be and there's no cleanup to be done.

> + if (test_thread_flag(TIF_SYSCALL_TRACE))
> + scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
> +
> if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
> trace_sys_enter(regs, scno);
> +
> audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
> regs->ARM_r2, regs->ARM_r3);
> +
> +out:
> return scno;
> }

Cheers,

Will

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/