Re: [PATCH v5 22/25] syscall_get_arch: add "struct task_struct *" argument

From: Kees Cook
Date: Mon Dec 10 2018 - 12:30:03 EST


On Sun, Dec 9, 2018 at 8:31 PM Dmitry V. Levin <ldv@xxxxxxxxxxxx> wrote:
>
> This argument is required to extend the generic ptrace API with
> PTRACE_GET_SYSCALL_INFO request: syscall_get_arch() is going
> to be called from ptrace_request() along with syscall_get_nr(),
> syscall_get_arguments(), syscall_get_error(), and
> syscall_get_return_value() functions with a tracee as their argument.
>
> Reverts: 5e937a9ae913 ("syscall_get_arch: remove useless function arguments")
> Reverts: 1002d94d3076 ("syscall.h: fix doc text for syscall_get_arch()")
> Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx> # for x86
> Reviewed-by: Palmer Dabbelt <palmer@xxxxxxxxxx>
> Acked-by: Paul Burton <paul.burton@xxxxxxxx> # MIPS parts
> Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)

For the seccomp parts:

Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>

-Kees

> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index f2ae2324c232..77cb87bd2eae 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -82,7 +82,7 @@ static void populate_seccomp_data(struct seccomp_data *sd)
> unsigned long args[6];
>
> sd->nr = syscall_get_nr(task, regs);
> - sd->arch = syscall_get_arch();
> + sd->arch = syscall_get_arch(task);
> syscall_get_arguments(task, regs, 0, 6, args);
> sd->args[0] = args[0];
> sd->args[1] = args[1];
> @@ -529,7 +529,7 @@ static void seccomp_init_siginfo(kernel_siginfo_t *info, int syscall, int reason
> info->si_code = SYS_SECCOMP;
> info->si_call_addr = (void __user *)KSTK_EIP(current);
> info->si_errno = reason;
> - info->si_arch = syscall_get_arch();
> + info->si_arch = syscall_get_arch(current);
> info->si_syscall = syscall;
> }
>
> --
> ldv



--
Kees Cook