[PATCH 83] ptrace(DETACH, SIGKILL) should really kill the tracee

Oleg Nesterov oleg at redhat.com
Sat Oct 10 17:58:10 UTC 2009


On 10/10, Jan Kratochvil wrote:
>
> On Sat, 10 Oct 2009 18:17:12 +0200, Oleg Nesterov wrote:
> > Roland, Jan, what user-space expects ptrace(DETACH, SIGKILL) should do?
> >
> > My guess: this should really kill the tracee asap, hence this patch.
>
> attached testcase works for me on both:
> kernel-2.6.31.1-48.fc12.x86_64
> kernel-2.6.30.5-43.fc11.x86_64
>
> does it FAIL for you to make it worth to the testsuite?

The changelog is not very clear, sorry.

Sure ptrace(DETACH, SIGKILL) works. Because currently detach always
wakes up the tracee. This should be fixed later, detach shouldn't
break the group-stop logic.

So, the point of this patch is: even we the tracee should be leaved
in TASK_STOPPED state, or we have another tracer which wants this
tracee to be stopped, SIGKILL must work and kille the tracee.

>   child = fork ();
>   switch (child)
>     {
>     case -1:
>       assert_perror (errno);
>
>     case 0:
>       l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
>       assert (l == 0);
>
>       raise (SIGUSR1);
>       _exit (42);
>
>     default:
>       break;
>     }
>
>   got_pid = waitpid (child, &status, 0);
>   assert (got_pid == child);
>   assert (WIFSTOPPED (status));
>   assert (WSTOPSIG (status) == SIGUSR1);
>
>   errno = 0;
>   l = ptrace (PTRACE_DETACH, child, NULL, (void *) (long) SIGKILL);
>   assert_perror (errno);
>   assert (l == 0);
>
>   got_pid = waitpid (child, &status, 0);
>   assert (got_pid == child);
>   assert (WIFSIGNALED (status));
>   assert (WTERMSIG (status) == SIGKILL);

I don't think this test-case is "interesting" in its current form.
It can't prove SIGKILL does something special, and I think currently
we can't test this.

Oleg.




More information about the utrace-devel mailing list