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

2009-12-14 Thread Jan Kratochvil
On Tue, 01 Dec 2009 18:38:27 +0100, Veaceslav Falico wrote:
 Instead of using fork(), call syscall(__NR_fork) in step-fork.c
 to avoid looping on powerpc arch in libc.

Checked-in.  (Not seen any problems with syscall and using glibc afterwards as
in the clone-multi-ptrace.c case so left it as is.)


Regards,
Jan


 Signed-off-by: Veaceslav Falico vfal...@redhat.com
 ---
 
 --- a/ptrace-tests/tests/step-fork.c  2009-12-01 17:17:14.0 +0100
 +++ b/ptrace-tests/tests/step-fork.c  2009-12-01 18:35:15.0 +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-kernelm=125927241130695
 +  */
 + if (syscall(__NR_fork) == 0)
 {
   read (-1, NULL, 0);
   _exit (22);



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

2009-12-05 Thread Oleg Nesterov
Jan, this fixes step-fork.c on powerpc.

Without this patch it just hangs, see

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

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 vfal...@redhat.com
 ---
 
 --- a/ptrace-tests/tests/step-fork.c  2009-12-01 17:17:14.0 +0100
 +++ b/ptrace-tests/tests/step-fork.c  2009-12-01 18:35:15.0 +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-kernelm=125927241130695
 +  */
 + if (syscall(__NR_fork) == 0)
 {
   read (-1, NULL, 0);
   _exit (22);



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

2009-12-01 Thread Veaceslav Falico
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 vfal...@redhat.com
---

--- a/ptrace-tests/tests/step-fork.c2009-12-01 17:17:14.0 +0100
+++ b/ptrace-tests/tests/step-fork.c2009-12-01 18:35:15.0 +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-kernelm=125927241130695
+*/
+   if (syscall(__NR_fork) == 0)
  {
read (-1, NULL, 0);
_exit (22);