• James Hogan's avatar
    MIPS/ptrace: Pick up ptrace/seccomp changed syscalls · b6318a90
    James Hogan authored
    The MIPS syscall_trace_enter() allows the system call number to be
    altered or cancelled by a ptrace tracer, via the normal ptrace hook
    (PTRACE_SYSCALL) and changing the system call number register on entry,
    and similarly via seccomp (PTRACE_EVENT_SECCOMP when a seccomp filter
    returns SECCOMP_RET_TRACE).
    
    Be sure to update the syscall local variable if this happens, so that
    seccomp will filter the correct system call number if the normal ptrace
    hook changes it first, and so that if either the normal ptrace hook or
    seccomp change it the correct system call number is passed to the trace
    event.
    
    This won't have any effect until the next commit, which fixes ptrace to
    update thread_info::syscall.
    
    Fixes: c2d9f177 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
    Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: Lars Persson <lars.persson@axis.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Will Drewry <wad@chromium.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/16996/
    b6318a90
ptrace.c 22.4 KB