[PATCH v3] USE_SEIZE: fix detaching from stopped processes

Dmitry V. Levin ldv at altlinux.org
Wed Jun 19 16:17:13 UTC 2013


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)
==============================

Process 23456 attached
--- SIGSTOP {si_signo=SIGSTOP, si_code=SI_USER, si_pid=0, si_uid=0} ---
--- stopped by SIGSTOP ---
restart_syscall(<... resuming interrupted call ...>Process 23456 detached
 <detached ...>
State:	S (sleeping)
detach-stopped: failed test: tracee is not group-stopped after detach

There is no such problem on recent kernels (tested on 3.9.6),
both use_seize and !use_seize cases work.

strace behaves as expected:

Process 30935 attached
wait4(-1, 0x7fff4fcfccc4, __WALL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=30878, si_uid=500} ---
rt_sigreturn()                          = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT PIPE TERM], NULL, 8) = 0
ptrace(PTRACE_DETACH, 30928, 0, SIG_0)  = -1 ESRCH (No such process)
tkill(30928, SIG_0)                     = 0
tkill(30928, SIGSTOP)                   = 0
wait4(30928, [{WIFSTOPPED(s) && WSTOPSIG(s) == 133}], __WALL, NULL) = 30928
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_TRAPPED, si_pid=30928, si_status=SIGTRAP, si_utime=0, si_stime=0} ---
ptrace(PTRACE_CONT, 30928, 0, SIG_0)    = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_TRAPPED, si_pid=30928, si_status=SIGSTOP, si_utime=0, si_stime=0} ---
wait4(30928, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGSTOP}], __WALL, NULL) = 30928
ptrace(PTRACE_DETACH, 30928, 0, SIG_0)  = 0
write(2, "Process 30928 detached\n", 23) = 23
write(2, " <detached ...>\n", 16)       = 16
exit_group(0)                           = ?
+++ exited with 0 +++


-- 
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/a0f62cda/attachment.bin>


More information about the Strace-devel mailing list