* [PATCH] selftests/powerpc: fix exec benchmark
@ 2018-05-12 3:35 Nicholas Piggin
2018-05-12 8:54 ` Mathieu Malaterre
2018-05-16 13:38 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Piggin @ 2018-05-12 3:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/powerpc: fix exec benchmark
2018-05-12 3:35 [PATCH] selftests/powerpc: fix exec benchmark Nicholas Piggin
@ 2018-05-12 8:54 ` Mathieu Malaterre
2018-05-12 16:35 ` Mathieu Malaterre
2018-05-16 13:38 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Mathieu Malaterre @ 2018-05-12 8:54 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev, Segher Boessenkool
Nick,
On Sat, May 12, 2018 at 5:35 AM, Nicholas Piggin <npiggin@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@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/powerpc: fix exec benchmark
2018-05-12 8:54 ` Mathieu Malaterre
@ 2018-05-12 16:35 ` Mathieu Malaterre
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Malaterre @ 2018-05-12 16:35 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev, Segher Boessenkool
On Sat, May 12, 2018 at 10:54 AM, Mathieu Malaterre <malat@debian.org> wrote:
> Nick,
>
> On Sat, May 12, 2018 at 5:35 AM, Nicholas Piggin <npiggin@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@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.
Nevermind, I did not tested and this seems not to be sufficient to
make the executable run properly.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: selftests/powerpc: fix exec benchmark
2018-05-12 3:35 [PATCH] selftests/powerpc: fix exec benchmark Nicholas Piggin
2018-05-12 8:54 ` Mathieu Malaterre
@ 2018-05-16 13:38 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-05-16 13:38 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin
On Sat, 2018-05-12 at 03:35:24 UTC, Nicholas Piggin 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@gmail.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/c906d2c74e0bb9059fbf43e21f8a96
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-16 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-12 3:35 [PATCH] selftests/powerpc: fix exec benchmark Nicholas Piggin
2018-05-12 8:54 ` Mathieu Malaterre
2018-05-12 16:35 ` Mathieu Malaterre
2018-05-16 13:38 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).