Re: [PATCH] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Denys Vlasenko
On 06/18/2013 10:36 PM, 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 ei

Re: [PATCH] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Dmitry V. Levin
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 wait

[PATCH v2] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Denys Vlasenko
V2: check WSTOPSIG(status) == syscall_trap_sig, not SIGTRAP. Add comments explaining what we think about the process status in detach() at various steps. Simplify PTRACE_CONT in wait loop since now syscall_trap_sig can't be seen there. Verified that tests/detach works. * strace.c (detach) [USE_SEI

detach() logic

2013-06-19 Thread Denys Vlasenko
Dmitry, I am a bit worried about the flow in this function still. Let's take a look: error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0); if (error == 0) { /* On a clear day, you can see forever. */ } else if (errno

Re: [PATCH v2] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Dmitry V. Levin
On Wed, Jun 19, 2013 at 12:58:13PM +0200, Denys Vlasenko wrote: > V2: check WSTOPSIG(status) == syscall_trap_sig, not SIGTRAP. > Add comments explaining what we think about the process status > in detach() at various steps. Simplify PTRACE_CONT > in wait loop since now syscall_trap_sig can't be see

Re: [PATCH v2] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Denys Vlasenko
On 06/19/2013 01:24 PM, Dmitry V. Levin wrote: > On Wed, Jun 19, 2013 at 12:58:13PM +0200, Denys Vlasenko wrote: >> V2: check WSTOPSIG(status) == syscall_trap_sig, not SIGTRAP. >> Add comments explaining what we think about the process status >> in detach() at various steps. Simplify PTRACE_CONT >>

Re: detach() logic

2013-06-19 Thread Dmitry V. Levin
On Wed, Jun 19, 2013 at 01:11:56PM +0200, Denys Vlasenko wrote: > Dmitry, I am a bit worried about the flow in this function still. > Let's take a look: > > error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0); > if (error == 0) { > /* On a clear da

Re: detach() logic

2013-06-19 Thread Denys Vlasenko
On 06/19/2013 02:35 PM, Dmitry V. Levin wrote: > On Wed, Jun 19, 2013 at 01:11:56PM +0200, Denys Vlasenko wrote: >> Dmitry, I am a bit worried about the flow in this function still. >> Let's take a look: >> >> error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0); >> if (err

[PATCH v3] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Denys Vlasenko
V3: split SEIZE/!SEIZE code paths to reduce confusion. Extensively comment every possible case. Verified that all tests/detach* tests work in both SEIZE and !SEIZE cases. * strace.c (detach): If PTRACE_SEIZE API is in use, stop the tracee using PTRACE_INTERRUPT instead of sending it a SIGSTOP. In

Re: [PATCH 2/2] powerpc: Provide a fallback for old kernels without PTRACE_GETREGS

2013-06-19 Thread Denys Vlasenko
On 06/10/2013 01:48 PM, Anton Blanchard wrote: > > PTRACE_GETREGS was added to the ppc kernel in 2.6.23. In order to > provide backward compatibility for very old kernels, add a manual > fallback. > # elif defined(POWERPC) > get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, (long) &ppc_r

Re: detach() logic

2013-06-19 Thread Dmitry V. Levin
On Wed, Jun 19, 2013 at 03:51:44PM +0200, Denys Vlasenko wrote: > On 06/19/2013 02:35 PM, Dmitry V. Levin wrote: > > On Wed, Jun 19, 2013 at 01:11:56PM +0200, Denys Vlasenko wrote: > >> Dmitry, I am a bit worried about the flow in this function still. > >> Let's take a look: > >> > >>

Re: [PATCH v3] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Dmitry V. Levin
On Wed, Jun 19, 2013 at 03:52:43PM +0200, Denys Vlasenko wrote: > V3: split SEIZE/!SEIZE code paths to reduce confusion. With your tests/detach* enhancements, I see persistent detach-stopped failures on old (!use_seize) kernels: $ cat detach-stopped.log FAIL: detach-stopped (exit: 1) ===

Re: [PATCH v3] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Dmitry V. Levin
On Wed, Jun 19, 2013 at 08:17:13PM +0400, Dmitry V. Levin wrote: > On Wed, Jun 19, 2013 at 03:52:43PM +0200, Denys Vlasenko wrote: > > V3: split SEIZE/!SEIZE code paths to reduce confusion. > > With your tests/detach* enhancements, I see persistent detach-stopped > failures on old (!use_seize) ker

Re: [PATCH v3] USE_SEIZE: fix detaching from stopped processes

2013-06-19 Thread Denys Vlasenko
On 06/19/2013 08:18 PM, Dmitry V. Levin wrote: > On Wed, Jun 19, 2013 at 08:17:13PM +0400, Dmitry V. Levin wrote: >> On Wed, Jun 19, 2013 at 03:52:43PM +0200, Denys Vlasenko wrote: >>> V3: split SEIZE/!SEIZE code paths to reduce confusion. >> >> With your tests/detach* enhancements, I see persisten