Blame SOURCES/strace-rh1466535.patch

384337
commit 1b93f4032a246e0aa43c2f424921e0aace57b994
384337
Author: Eugene Syromyatnikov <evgsyr@gmail.com>
384337
Date:   Fri Aug 4 11:33:04 2017 +0200
384337
384337
    Improve handling of unexpected tracees
384337
    
384337
    When receiving a ptrace stop of an unexpected child, handle it
384337
    in the most transparent way possible:
384337
    - detach it instead of PTRACE_CONT'ing;
384337
    - send it the signal with which it has been stopped.
384337
    This should hopefully help to deal with processes that have been created
384337
    with misused CLONE_PTRACE flag set.
384337
    
384337
    * strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
384337
    Calculate the signal similarly to the way next_event does,
384337
    forward it to the unexpected tracee, and detach the tracee.
384337
384337
commit 7a35b711df127664e7430b2644ae92c75f3d5f67
384337
Author: Dmitry V. Levin <ldv@altlinux.org>
384337
Date:   Sun Aug 6 13:27:07 2017 +0000
384337
384337
    Fix handling of unexpected tracees when PTRACE_SEIZE is not in use
384337
    
384337
    * strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
384337
    The expected ptrace stop signal in case of !use seize is not
384337
    syscall_trap_sig but SIGSTOP.  An idea of using PTRACE_GETSIGINFO to
384337
    distinguish signal stops that should be re-injected from other kinds
384337
    of stops didn't work out due to kernel implementation peculiarities
384337
    of initial ptrace-stop.
384337
384337
commit 330f4633d5103938982602b6f21f761570e3482c
384337
Author: Dmitry V. Levin <ldv@altlinux.org>
384337
Date:   Sun Aug 6 15:10:56 2017 +0000
384337
384337
    Simplify handling of unexpected tracees
384337
    
384337
    * strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
384337
    Remove the dance around possible re-injection of WSTOPSIG(status)
384337
    as the only observable stop here is the initial ptrace-stop.
384337
384337
diff -rup a/strace.c b/strace.c
384337
--- a/strace.c	2017-08-31 14:04:21.000000000 -0400
384337
+++ b/strace.c	2017-08-31 14:51:32.523134570 -0400
384337
@@ -1958,11 +1958,15 @@ maybe_allocate_tcb(const int pid, int st
384337
 			error_msg("Process %d attached", pid);
384337
 		return tcp;
384337
 	} else {
384337
-		/* This can happen if a clone call used
384337
-		 * CLONE_PTRACE itself.
384337
+		/*
384337
+		 * This can happen if a clone call misused CLONE_PTRACE itself.
384337
+		 *
384337
+		 * There used to be a dance around possible re-injection of
384337
+		 * WSTOPSIG(status), but it was later removed as the only
384337
+		 * observable stop here is the initial ptrace-stop.
384337
 		 */
384337
-		ptrace(PTRACE_CONT, pid, (char *) 0, 0);
384337
-		error_msg("Stop of unknown pid %u seen, PTRACE_CONTed it", pid);
384337
+		ptrace(PTRACE_DETACH, pid, NULL, 0L);
384337
+		error_msg("Detached unknown pid %d", pid);
384337
 		return NULL;
384337
 	}
384337
 }