powerpc/kernel: Change the do_syscall_trace_enter() API
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 23 Jul 2015 10:21:02 +0000 (20:21 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Jul 2015 01:56:11 +0000 (11:56 +1000)
commitd38374142b2560f233961ed3756416c68af6c6cb
tree404b608eef9a89f2b91c4152e6499a38fff449f1
parentc3525940cca53cf3568fefd35d169fea4f107f0a
powerpc/kernel: Change the do_syscall_trace_enter() API

The API for calling do_syscall_trace_enter() is currently sensible
enough, it just returns the (modified) syscall number.

However once we enable seccomp filter it will get more complicated. When
seccomp filter runs, the seccomp kernel code (via SECCOMP_RET_ERRNO), or
a ptracer (via SECCOMP_RET_TRACE), may reject the syscall and *may* or may
*not* set a return value in r3.

That means the assembler that calls do_syscall_trace_enter() can not
blindly return ENOSYS, it needs to only return ENOSYS if a return value
has not already been set.

There is no way to implement that logic with the current API. So change
the do_syscall_trace_enter() API to make it deal with the return code
juggling, and the assembler can then just return whatever return code it
is given.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Kees Cook <keescook@chromium.org>
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/ptrace.c