On Wed, 15 Jan 2014 18:20:49 +0100, Mark Wielaard wrote:
> I admit it wasn't immediately obvious to me why we were letting the
> child dump core in this case.

BTW it is a regression since
        70c3a53baa06b6cdee6e92bd673c1cf977066bc1
        tests: Don't use ptrace detach stopped trick. Raise can return.

Although previously it was not much correct as it left the SIGSTOPped process
to be reparented to PID 1 which somehow correctly discarded it.


> So please at least add a comment here why we are forcefully killing the
> child. But I think a nicer fix would be to just let the child exit
> normally after raise () returns.

The stack is corrupt at this point but OK, it can be done.


Thanks,
Jan
--- Begin Message ---
tests/
2014-01-18  Jan Kratochvil  <[email protected]>

        Fix false FAILs on testsuite with ulimit -c unlimited.
        * backtrace-child.c (sigusr2): Call pthread_exit.
        (main): Return, do not call abort.

Signed-off-by: Jan Kratochvil <[email protected]>
---
 tests/backtrace-child.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c
index 0db1258..512aa23 100644
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -100,7 +100,10 @@ sigusr2 (int signo)
   if (! gencore)
     {
       raise (SIGUSR1);
-      /* It should not be reached.  */
+      /* Do not return as stack may be invalid due to ptrace-patched PC to the
+        jmp function.  */
+      pthread_exit (NULL);
+      /* Not reached.  */
       abort ();
     }
   /* Here we dump the core for --gencore.  */
@@ -218,6 +221,5 @@ main (int argc UNUSED, char **argv)
     pthread_join (thread, NULL);
   else
     raise (SIGUSR2);
-  /* Not reached.  */
-  abort ();
+  return 0;
 }
-- 
1.8.4.2

--- End Message ---

Reply via email to