utrace-ptrace && detach with signal semantics

Oleg Nesterov oleg at redhat.com
Sat Oct 10 16:24:21 UTC 2009


On 10/06, Jan Kratochvil wrote:
>
> Yes, I agree with the current general behavior of ptrace there is missing:
>            if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGPIPE)
>
> [...snip...]
>
> --- attach-into-signal.c	31 Jan 2009 21:11:40 -0000	1.5
> +++ attach-into-signal.c	6 Oct 2009 14:27:08 -0000
> @@ -224,6 +224,18 @@ static void reproduce (void)
>        child = 0;
>        return;
>      }
> +  /* SIGPIPE was still pending and it has not been yet delivered.  */
> +  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGPIPE)
> +    {
> +      /* Deliver it and get the queued SIGSTOP.  */
> +      errno = 0;
> +      ptrace (PTRACE_CONT, child, (void *) 1, (void *) SIGPIPE);
> +      assert_perror (errno);
> +
> +      errno = 0;
> +      pid = waitpid (child, &status, 0);
> +      assert (pid == child);
> +    }
>    assert (WIFSTOPPED (status));
>    assert (WSTOPSIG (status) == SIGSTOP);
>    /* let tracee run. it must be killed very soon by SIGPIPE */

Jan, please revert this change.

Roland thinks we should keep this behaviour, this means attach-into-signal.c
checks (in particular) exactly what we want: the new attach must not see SIGPIPE.

With the recent patches utrace-ptrace passes this test-case too.

Oleg.




More information about the utrace-devel mailing list