[PATCH] USE_SEIZE: fix detaching from stopped processes
Dmitry V. Levin
ldv at altlinux.org
Wed Jun 19 10:35:54 UTC 2013
On Wed, Jun 19, 2013 at 12:36:20AM +0400, Dmitry V. Levin wrote:
> On Tue, Jun 18, 2013 at 06:18:14PM +0200, Denys Vlasenko wrote:
> > * strace.c (detach) [USE_SEIZE]: If PTRACE_SEIZE API is in use, stop
> > the tracee using PTRACE_INTERRUPT instead of sending it a SIGSTOP.
> > In a subsequent waitpid loop, wait for either SIGSTOP or SIGTRAP.
[...]
> > @@ -810,7 +819,9 @@ detach(struct tcb *tcp)
> > /* Au revoir, mon ami. */
> > break;
> > }
> > - if (WSTOPSIG(status) == SIGSTOP) {
> > + if (WSTOPSIG(status) == SIGSTOP
> > + || WSTOPSIG(status) == SIGTRAP /* may be generated by PTRACE_INTERRUPT stop */
> > + ) {
>
> In case of PTRACE_INTERRUPT this WSTOPSIG(status) is not plain SIGTRAP
> but (SIGTRAP | 0x80), which also may happen in other !use_seize cases.
> That is, the right check seems to be
> WSTOPSIG(status) == SIGSTOP ||
> (use_seize && WSTOPSIG(status) == (SIGTRAP | 0x80))
> It also passes both tests/detach-sleeping and tests/detach-stopped.
It still hangs while detaching from a running process
(just added tests/detach-running fails). What seems to work so far is
WSTOPSIG(status) == SIGSTOP ||
(use_seize && (WSTOPSIG(status) & 0x7f) == SIGTRAP)
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130619/26fca3c2/attachment.bin>
More information about the Strace-devel
mailing list