[PATCH] selftests/powerpc: fix exec benchmark

Mathieu Malaterre malat at debian.org
Sat May 12 18:54:03 AEST 2018


Nick,

On Sat, May 12, 2018 at 5:35 AM, Nicholas Piggin <npiggin at gmail.com> wrote:
> The exec_target binary could segfault calling _exit(2) because r13
> is not set up properly (and libc looks at that when performing a
> syscall). Call SYS_exit using syscall(2) which doesn't seem to
> have this problem.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  tools/testing/selftests/powerpc/benchmarks/exec_target.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/powerpc/benchmarks/exec_target.c b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> index 3c9c144192be..c14b0fc1edde 100644
> --- a/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> +++ b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> @@ -6,8 +6,11 @@
>   * Copyright 2018, Anton Blanchard, IBM Corp.
>   */
>
> -void _exit(int);
> +#define _GNU_SOURCE
> +#include <unistd.h>
> +#include <sys/syscall.h>
> +
>  void _start(void)
>  {
> -       _exit(0);
> +       syscall(SYS_exit, 0);
>  }
> --
> 2.17.0
>

Could you please apply the same patch to :

./tools/testing/selftests/size/get_size.c

It segfault on ppc32 with default cross compiler from Debian.

Thanks


More information about the Linuxppc-dev mailing list