[PATCH v2] ptrace-tests: fix step-fork.c on powerpc for ptrace-utrace

Oleg Nesterov oleg at redhat.com
Sat Dec 5 17:01:12 UTC 2009


Jan, this fixes step-fork.c on powerpc.

Without this patch it just hangs, see

	http://marc.info/?t=125924748600001

On 12/01, Veaceslav Falico wrote:
>
> Instead of using fork(), call syscall(__NR_fork) in step-fork.c
> to avoid looping on powerpc arch in libc.
> 
> Signed-off-by: Veaceslav Falico <vfalico at redhat.com>
> ---
> 
> --- a/ptrace-tests/tests/step-fork.c	2009-12-01 17:17:14.000000000 +0100
> +++ b/ptrace-tests/tests/step-fork.c	2009-12-01 18:35:15.000000000 +0100
> @@ -29,6 +29,7 @@
>  #include <unistd.h>
>  #include <sys/wait.h>
>  #include <string.h>
> +#include <sys/syscall.h>
>  #include <signal.h>
>  
>  #ifndef PTRACE_SINGLESTEP
> @@ -78,7 +79,12 @@ main (int argc, char **argv)
>  	sigprocmask (SIG_BLOCK, &mask, NULL);
>  	ptrace (PTRACE_TRACEME);
>  	raise (SIGUSR1);
> -	if (fork () == 0)
> +
> +	/*
> +	 * Can't use fork() directly because on powerpc it loops inside libc under
> +	 * PTRACE_SINGLESTEP. See http://marc.info/?l=linux-kernel&m=125927241130695
> +	 */
> +	if (syscall(__NR_fork) == 0)
>  	  {
>  	    read (-1, NULL, 0);
>  	    _exit (22);




More information about the utrace-devel mailing list