[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jK0TMJ-K6jYrZMzeMFb0QYC4Zg-9Sdd-ih+Qpj2EG9fsQ@mail.gmail.com>
Date: Wed, 15 Jul 2015 08:16:49 -0700
From: Kees Cook <keescook@...omium.org>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: "linuxppc-dev@...abs.org" <linuxppc-dev@...abs.org>,
LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>, strosake@...ux.vnet.ibm.com,
bogdan.purcareata@...escale.com
Subject: Re: [RFC PATCH 12/12] selftests/seccomp: Add powerpc support
On Wed, Jul 15, 2015 at 12:37 AM, Michael Ellerman <mpe@...erman.id.au> wrote:
> Wire up the syscall number and regs so the tests work on powerpc.
>
> Signed-off-by: Michael Ellerman <mpe@...erman.id.au>
Acked-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
> tools/testing/selftests/seccomp/seccomp_bpf.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index 51adb9afb511..05fcdb974df6 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -14,6 +14,7 @@
> #include <linux/filter.h>
> #include <sys/prctl.h>
> #include <sys/ptrace.h>
> +#include <sys/types.h>
> #include <sys/user.h>
> #include <linux/prctl.h>
> #include <linux/ptrace.h>
> @@ -1209,6 +1210,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
> # define ARCH_REGS struct user_pt_regs
> # define SYSCALL_NUM regs[8]
> # define SYSCALL_RET regs[0]
> +#elif defined(__powerpc__)
> +# define ARCH_REGS struct pt_regs
> +# define SYSCALL_NUM gpr[0]
> +# define SYSCALL_RET gpr[3]
> #else
> # error "Do not know how to find your architecture's registers and syscalls"
> #endif
> @@ -1242,7 +1247,7 @@ void change_syscall(struct __test_metadata *_metadata,
> ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
> EXPECT_EQ(0, ret);
>
> -#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
> +#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__)
> {
> regs.SYSCALL_NUM = syscall;
> }
> @@ -1406,6 +1411,8 @@ TEST_F(TRACE_syscall, syscall_dropped)
> # define __NR_seccomp 383
> # elif defined(__aarch64__)
> # define __NR_seccomp 277
> +# elif defined(__powerpc__)
> +# define __NR_seccomp 358
> # else
> # warning "seccomp syscall number unknown for this architecture"
> # define __NR_seccomp 0xffff
> --
> 2.1.0
>
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists