Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc: fix exec benchmark

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@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Nicholas Piggin and committed by
Michael Ellerman
c906d2c7 7ef73cd3

+5 -2
+5 -2
tools/testing/selftests/powerpc/benchmarks/exec_target.c
··· 6 6 * Copyright 2018, Anton Blanchard, IBM Corp. 7 7 */ 8 8 9 - void _exit(int); 9 + #define _GNU_SOURCE 10 + #include <unistd.h> 11 + #include <sys/syscall.h> 12 + 10 13 void _start(void) 11 14 { 12 - _exit(0); 15 + syscall(SYS_exit, 0); 13 16 }