Blob Blame History Raw
From 96dc1aa20237b80087f6c9ee29147bb85a5594d9 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 6 Mar 2019 16:02:38 +0000
Subject: [PATCH 24/27] tests: check tracing of orphaned process group

* tests/orphaned_process_group.c: New file.
* tests/.gitignore: Add orphaned_process_group.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (orphaned_process_group): New test.

Skipped files (not present in the tarball):
	tests/.gitignore

Additional changes:
	tests/Makefile.in (generated from tests/Makefile.am)
	tests/tests/orphaned_process_group.gen.test (generated from tests/gen_tests.in)
	tests-m32/Makefile.in (generated from tests-m32/Makefile.am)
	tests-m32/gen_tests.in (copy of tests/gen_tests.in)
	tests-m32/orphaned_process_group.c (copy of tests/orphaned_process_group.c)
	tests-m32/tests/orphaned_process_group.gen.test (generated from tests-m32/gen_tests.in)
	tests-mx32/Makefile.in (generated from tests-mx32/Makefile.am)
	tests-mx32/gen_tests.in (copy of tests/gen_tests.in)
	tests-mx32/orphaned_process_group.c (copy of tests/orphaned_process_group.c)
	tests-mx32/tests/orphaned_process_group.gen.test (generated from tests-mx32/gen_tests.in)

---
 tests/.gitignore               |   1 +
 tests/Makefile.am              |   1 +
 tests/gen_tests.in             |   1 +
 tests/orphaned_process_group.c | 155 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 158 insertions(+)
 create mode 100644 tests/orphaned_process_group.c

Index: strace-4.24/tests/Makefile.am
===================================================================
--- strace-4.24.orig/tests/Makefile.am	2019-03-10 05:47:36.446486219 +0100
+++ strace-4.24/tests/Makefile.am	2019-03-10 05:50:05.488993755 +0100
@@ -120,6 +120,7 @@
 	nsyscalls-d \
 	oldselect-P \
 	oldselect-efault-P \
+	orphaned_process_group \
 	pc \
 	perf_event_open_nonverbose \
 	perf_event_open_unabbrev \
Index: strace-4.24/tests/gen_tests.in
===================================================================
--- strace-4.24.orig/tests/gen_tests.in	2019-03-10 05:19:26.185411954 +0100
+++ strace-4.24/tests/gen_tests.in	2019-03-10 05:50:05.488993755 +0100
@@ -287,6 +287,7 @@
 oldstat	-a32 -v -P stat.sample -P /dev/full
 open	-a30 -P $NAME.sample
 openat	-a36 -P $NAME.sample
+orphaned_process_group	. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
 osf_utimes	-a21
 pause	-a8 -esignal=none
 perf_event_open	-a1
Index: strace-4.24/tests/orphaned_process_group.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests/orphaned_process_group.c	2019-03-10 05:50:05.488993755 +0100
@@ -0,0 +1,155 @@
+/*
+ * Check tracing of orphaned process group.
+ *
+ * Copyright (c) 2019 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define TIMEOUT 5
+
+static void
+alarm_handler(const int no)
+{
+	error_msg_and_skip("Orphaned process group semantics"
+			   " is not supported by the kernel");
+}
+
+int
+main(void)
+{
+	int status;
+
+	/*
+	 * Unblock all signals.
+	 */
+	static sigset_t mask;
+	if (sigprocmask(SIG_SETMASK, &mask, NULL))
+		perror_msg_and_fail("sigprocmask");
+
+	/*
+	 * Create a pipe to track termination of processes.
+	 */
+	int pipe_fds[2];
+	if (pipe(pipe_fds))
+		perror_msg_and_fail("pipe");
+
+	/*
+	 * Create a leader for its own new process group.
+	 */
+	pid_t leader = fork();
+	if (leader < 0)
+		perror_msg_and_fail("fork");
+
+	if (leader) {
+		/*
+		 * Close the writing end of the pipe.
+		 */
+		close(pipe_fds[1]);
+
+		/*
+		 * Install the SIGALRM signal handler.
+		 */
+		static const struct sigaction sa = {
+			.sa_handler = alarm_handler
+		};
+		if (sigaction(SIGALRM, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		/*
+		 * Set an alarm clock.
+		 */
+		alarm(TIMEOUT);
+
+		/*
+		 * Wait for termination of the child process.
+		 */
+		if (waitpid(leader, &status, 0) != leader)
+			perror_msg_and_fail("waitpid leader");
+		if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+			error_msg_and_fail("waitpid leader: "
+					   "unexpected wait status %d",
+					   status);
+
+		/*
+		 * Wait for termination of all processes
+		 * in the process group of the child process.
+		 */
+		if (read(pipe_fds[0], &status, sizeof(status)) != 0)
+			perror_msg_and_fail("read");
+
+		/*
+		 * At this point all processes are gone.
+		 * Let the tracer time to catch up.
+		 */
+		alarm(0);
+		sleep(1);
+		return 0;
+	}
+
+	/*
+	 * Close the reading end of the pipe.
+	 */
+	close(pipe_fds[0]);
+
+	/*
+	 * Create a new process group.
+	 */
+	if (setpgid(0, 0))
+		perror_msg_and_fail("setpgid");
+
+	/*
+	 * When the leader process terminates, the process group becomes orphaned.
+	 * If any member of the orphaned process group is stopped, then
+	 * a SIGHUP signal followed by a SIGCONT signal is sent to each process
+	 * in the orphaned process group.
+	 * Create a process in a stopped state to activate this behaviour.
+	 */
+	const pid_t stopped = fork();
+	if (stopped < 0)
+		perror_msg_and_fail("fork");
+	if (!stopped) {
+		static const struct sigaction sa = { .sa_handler = SIG_DFL };
+		if (sigaction(SIGHUP, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		raise(SIGSTOP);
+		_exit(0);
+	}
+
+	/*
+	 * Wait for the process to stop.
+	 */
+	if (waitpid(stopped, &status, WUNTRACED) != stopped)
+		perror_msg_and_fail("waitpid WUNTRACED");
+	if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
+                error_msg_and_fail("unexpected wait status %d", status);
+
+	/*
+	 * Print the expected output.
+	 */
+	leader = getpid();
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
+	       ", si_pid=%d, si_uid=%u} ---\n",
+	       stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
+	printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
+	printf("%-5d +++ exited with 0 +++\n", leader);
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_KERNEL} ---\n",
+	       stopped, "SIGHUP", "SIGHUP");
+	printf("%-5d +++ killed by %s +++\n", stopped, "SIGHUP");
+	printf("%-5d +++ exited with 0 +++\n", getppid());
+
+	/*
+	 * Make the process group orphaned.
+	 */
+	return 0;
+}
Index: strace-4.24/tests-m32/orphaned_process_group.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests-m32/orphaned_process_group.c	2019-03-10 05:51:47.527971970 +0100
@@ -0,0 +1,155 @@
+/*
+ * Check tracing of orphaned process group.
+ *
+ * Copyright (c) 2019 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define TIMEOUT 5
+
+static void
+alarm_handler(const int no)
+{
+	error_msg_and_skip("Orphaned process group semantics"
+			   " is not supported by the kernel");
+}
+
+int
+main(void)
+{
+	int status;
+
+	/*
+	 * Unblock all signals.
+	 */
+	static sigset_t mask;
+	if (sigprocmask(SIG_SETMASK, &mask, NULL))
+		perror_msg_and_fail("sigprocmask");
+
+	/*
+	 * Create a pipe to track termination of processes.
+	 */
+	int pipe_fds[2];
+	if (pipe(pipe_fds))
+		perror_msg_and_fail("pipe");
+
+	/*
+	 * Create a leader for its own new process group.
+	 */
+	pid_t leader = fork();
+	if (leader < 0)
+		perror_msg_and_fail("fork");
+
+	if (leader) {
+		/*
+		 * Close the writing end of the pipe.
+		 */
+		close(pipe_fds[1]);
+
+		/*
+		 * Install the SIGALRM signal handler.
+		 */
+		static const struct sigaction sa = {
+			.sa_handler = alarm_handler
+		};
+		if (sigaction(SIGALRM, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		/*
+		 * Set an alarm clock.
+		 */
+		alarm(TIMEOUT);
+
+		/*
+		 * Wait for termination of the child process.
+		 */
+		if (waitpid(leader, &status, 0) != leader)
+			perror_msg_and_fail("waitpid leader");
+		if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+			error_msg_and_fail("waitpid leader: "
+					   "unexpected wait status %d",
+					   status);
+
+		/*
+		 * Wait for termination of all processes
+		 * in the process group of the child process.
+		 */
+		if (read(pipe_fds[0], &status, sizeof(status)) != 0)
+			perror_msg_and_fail("read");
+
+		/*
+		 * At this point all processes are gone.
+		 * Let the tracer time to catch up.
+		 */
+		alarm(0);
+		sleep(1);
+		return 0;
+	}
+
+	/*
+	 * Close the reading end of the pipe.
+	 */
+	close(pipe_fds[0]);
+
+	/*
+	 * Create a new process group.
+	 */
+	if (setpgid(0, 0))
+		perror_msg_and_fail("setpgid");
+
+	/*
+	 * When the leader process terminates, the process group becomes orphaned.
+	 * If any member of the orphaned process group is stopped, then
+	 * a SIGHUP signal followed by a SIGCONT signal is sent to each process
+	 * in the orphaned process group.
+	 * Create a process in a stopped state to activate this behaviour.
+	 */
+	const pid_t stopped = fork();
+	if (stopped < 0)
+		perror_msg_and_fail("fork");
+	if (!stopped) {
+		static const struct sigaction sa = { .sa_handler = SIG_DFL };
+		if (sigaction(SIGHUP, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		raise(SIGSTOP);
+		_exit(0);
+	}
+
+	/*
+	 * Wait for the process to stop.
+	 */
+	if (waitpid(stopped, &status, WUNTRACED) != stopped)
+		perror_msg_and_fail("waitpid WUNTRACED");
+	if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
+                error_msg_and_fail("unexpected wait status %d", status);
+
+	/*
+	 * Print the expected output.
+	 */
+	leader = getpid();
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
+	       ", si_pid=%d, si_uid=%u} ---\n",
+	       stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
+	printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
+	printf("%-5d +++ exited with 0 +++\n", leader);
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_KERNEL} ---\n",
+	       stopped, "SIGHUP", "SIGHUP");
+	printf("%-5d +++ killed by %s +++\n", stopped, "SIGHUP");
+	printf("%-5d +++ exited with 0 +++\n", getppid());
+
+	/*
+	 * Make the process group orphaned.
+	 */
+	return 0;
+}
Index: strace-4.24/tests-mx32/orphaned_process_group.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests-mx32/orphaned_process_group.c	2019-03-10 05:51:50.259944613 +0100
@@ -0,0 +1,155 @@
+/*
+ * Check tracing of orphaned process group.
+ *
+ * Copyright (c) 2019 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define TIMEOUT 5
+
+static void
+alarm_handler(const int no)
+{
+	error_msg_and_skip("Orphaned process group semantics"
+			   " is not supported by the kernel");
+}
+
+int
+main(void)
+{
+	int status;
+
+	/*
+	 * Unblock all signals.
+	 */
+	static sigset_t mask;
+	if (sigprocmask(SIG_SETMASK, &mask, NULL))
+		perror_msg_and_fail("sigprocmask");
+
+	/*
+	 * Create a pipe to track termination of processes.
+	 */
+	int pipe_fds[2];
+	if (pipe(pipe_fds))
+		perror_msg_and_fail("pipe");
+
+	/*
+	 * Create a leader for its own new process group.
+	 */
+	pid_t leader = fork();
+	if (leader < 0)
+		perror_msg_and_fail("fork");
+
+	if (leader) {
+		/*
+		 * Close the writing end of the pipe.
+		 */
+		close(pipe_fds[1]);
+
+		/*
+		 * Install the SIGALRM signal handler.
+		 */
+		static const struct sigaction sa = {
+			.sa_handler = alarm_handler
+		};
+		if (sigaction(SIGALRM, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		/*
+		 * Set an alarm clock.
+		 */
+		alarm(TIMEOUT);
+
+		/*
+		 * Wait for termination of the child process.
+		 */
+		if (waitpid(leader, &status, 0) != leader)
+			perror_msg_and_fail("waitpid leader");
+		if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+			error_msg_and_fail("waitpid leader: "
+					   "unexpected wait status %d",
+					   status);
+
+		/*
+		 * Wait for termination of all processes
+		 * in the process group of the child process.
+		 */
+		if (read(pipe_fds[0], &status, sizeof(status)) != 0)
+			perror_msg_and_fail("read");
+
+		/*
+		 * At this point all processes are gone.
+		 * Let the tracer time to catch up.
+		 */
+		alarm(0);
+		sleep(1);
+		return 0;
+	}
+
+	/*
+	 * Close the reading end of the pipe.
+	 */
+	close(pipe_fds[0]);
+
+	/*
+	 * Create a new process group.
+	 */
+	if (setpgid(0, 0))
+		perror_msg_and_fail("setpgid");
+
+	/*
+	 * When the leader process terminates, the process group becomes orphaned.
+	 * If any member of the orphaned process group is stopped, then
+	 * a SIGHUP signal followed by a SIGCONT signal is sent to each process
+	 * in the orphaned process group.
+	 * Create a process in a stopped state to activate this behaviour.
+	 */
+	const pid_t stopped = fork();
+	if (stopped < 0)
+		perror_msg_and_fail("fork");
+	if (!stopped) {
+		static const struct sigaction sa = { .sa_handler = SIG_DFL };
+		if (sigaction(SIGHUP, &sa, NULL))
+			perror_msg_and_fail("sigaction");
+
+		raise(SIGSTOP);
+		_exit(0);
+	}
+
+	/*
+	 * Wait for the process to stop.
+	 */
+	if (waitpid(stopped, &status, WUNTRACED) != stopped)
+		perror_msg_and_fail("waitpid WUNTRACED");
+	if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
+                error_msg_and_fail("unexpected wait status %d", status);
+
+	/*
+	 * Print the expected output.
+	 */
+	leader = getpid();
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
+	       ", si_pid=%d, si_uid=%u} ---\n",
+	       stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
+	printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
+	printf("%-5d +++ exited with 0 +++\n", leader);
+	printf("%-5d --- %s {si_signo=%s, si_code=SI_KERNEL} ---\n",
+	       stopped, "SIGHUP", "SIGHUP");
+	printf("%-5d +++ killed by %s +++\n", stopped, "SIGHUP");
+	printf("%-5d +++ exited with 0 +++\n", getppid());
+
+	/*
+	 * Make the process group orphaned.
+	 */
+	return 0;
+}
Index: strace-4.24/tests/Makefile.in
===================================================================
--- strace-4.24.orig/tests/Makefile.in	2019-03-10 05:40:37.973676673 +0100
+++ strace-4.24/tests/Makefile.in	2019-03-10 05:56:10.763336015 +0100
@@ -161,8 +161,8 @@
 	net-tpacket_stats-success$(EXEEXT) netlink_inet_diag$(EXEEXT) \
 	netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \
 	nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \
-	oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \
-	perf_event_open_nonverbose$(EXEEXT) \
+	oldselect-efault-P$(EXEEXT) orphaned_process_group$(EXEEXT) \
+	pc$(EXEEXT) perf_event_open_nonverbose$(EXEEXT) \
 	perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \
 	prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \
 	prctl-spec-inject$(EXEEXT) print_maxfd$(EXEEXT) \
@@ -1743,6 +1743,10 @@
 openat_OBJECTS = openat.$(OBJEXT)
 openat_LDADD = $(LDADD)
 openat_DEPENDENCIES = libtests.a
+orphaned_process_group_SOURCES = orphaned_process_group.c
+orphaned_process_group_OBJECTS = orphaned_process_group.$(OBJEXT)
+orphaned_process_group_LDADD = $(LDADD)
+orphaned_process_group_DEPENDENCIES = libtests.a
 osf_utimes_SOURCES = osf_utimes.c
 osf_utimes_OBJECTS = osf_utimes.$(OBJEXT)
 osf_utimes_LDADD = $(LDADD)
@@ -2786,7 +2790,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -2931,7 +2936,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -4058,7 +4064,8 @@
 	oldselect.gen.test oldselect-P.gen.test \
 	oldselect-efault.gen.test oldselect-efault-P.gen.test \
 	oldstat.gen.test open.gen.test openat.gen.test \
-	osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \
+	orphaned_process_group.gen.test osf_utimes.gen.test \
+	pause.gen.test perf_event_open.gen.test \
 	perf_event_open_nonverbose.gen.test \
 	perf_event_open_unabbrev.gen.test personality-Xabbrev.gen.test \
 	personality-Xraw.gen.test personality-Xverbose.gen.test \
@@ -5752,6 +5759,10 @@
 	@rm -f openat$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(openat_OBJECTS) $(openat_LDADD) $(LIBS)
 
+orphaned_process_group$(EXEEXT): $(orphaned_process_group_OBJECTS) $(orphaned_process_group_DEPENDENCIES) $(EXTRA_orphaned_process_group_DEPENDENCIES) 
+	@rm -f orphaned_process_group$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(orphaned_process_group_OBJECTS) $(orphaned_process_group_LDADD) $(LIBS)
+
 osf_utimes$(EXEEXT): $(osf_utimes_OBJECTS) $(osf_utimes_DEPENDENCIES) $(EXTRA_osf_utimes_DEPENDENCIES) 
 	@rm -f osf_utimes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(osf_utimes_OBJECTS) $(osf_utimes_LDADD) $(LIBS)
@@ -7030,6 +7041,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orphaned_process_group.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osf_utimes.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pause.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pc.Po@am__quote@
@@ -9128,6 +9140,9 @@
 $(srcdir)/openat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
+$(srcdir)/orphaned_process_group.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
+	$(AM_V_GEN) $^ $@
+
 $(srcdir)/osf_utimes.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
Index: strace-4.24/tests-m32/Makefile.in
===================================================================
--- strace-4.24.orig/tests-m32/Makefile.in	2019-03-10 05:44:56.112091757 +0100
+++ strace-4.24/tests-m32/Makefile.in	2019-03-10 05:57:09.322749620 +0100
@@ -161,8 +161,8 @@
 	net-tpacket_stats-success$(EXEEXT) netlink_inet_diag$(EXEEXT) \
 	netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \
 	nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \
-	oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \
-	perf_event_open_nonverbose$(EXEEXT) \
+	oldselect-efault-P$(EXEEXT) orphaned_process_group$(EXEEXT) \
+	pc$(EXEEXT) perf_event_open_nonverbose$(EXEEXT) \
 	perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \
 	prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \
 	prctl-spec-inject$(EXEEXT) print_maxfd$(EXEEXT) \
@@ -1743,6 +1743,10 @@
 openat_OBJECTS = openat.$(OBJEXT)
 openat_LDADD = $(LDADD)
 openat_DEPENDENCIES = libtests.a
+orphaned_process_group_SOURCES = orphaned_process_group.c
+orphaned_process_group_OBJECTS = orphaned_process_group.$(OBJEXT)
+orphaned_process_group_LDADD = $(LDADD)
+orphaned_process_group_DEPENDENCIES = libtests.a
 osf_utimes_SOURCES = osf_utimes.c
 osf_utimes_OBJECTS = osf_utimes.$(OBJEXT)
 osf_utimes_LDADD = $(LDADD)
@@ -2786,7 +2790,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -2931,7 +2936,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -4058,7 +4064,8 @@
 	oldselect.gen.test oldselect-P.gen.test \
 	oldselect-efault.gen.test oldselect-efault-P.gen.test \
 	oldstat.gen.test open.gen.test openat.gen.test \
-	osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \
+	orphaned_process_group.gen.test osf_utimes.gen.test \
+	pause.gen.test perf_event_open.gen.test \
 	perf_event_open_nonverbose.gen.test \
 	perf_event_open_unabbrev.gen.test personality-Xabbrev.gen.test \
 	personality-Xraw.gen.test personality-Xverbose.gen.test \
@@ -5752,6 +5759,10 @@
 	@rm -f openat$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(openat_OBJECTS) $(openat_LDADD) $(LIBS)
 
+orphaned_process_group$(EXEEXT): $(orphaned_process_group_OBJECTS) $(orphaned_process_group_DEPENDENCIES) $(EXTRA_orphaned_process_group_DEPENDENCIES) 
+	@rm -f orphaned_process_group$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(orphaned_process_group_OBJECTS) $(orphaned_process_group_LDADD) $(LIBS)
+
 osf_utimes$(EXEEXT): $(osf_utimes_OBJECTS) $(osf_utimes_DEPENDENCIES) $(EXTRA_osf_utimes_DEPENDENCIES) 
 	@rm -f osf_utimes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(osf_utimes_OBJECTS) $(osf_utimes_LDADD) $(LIBS)
@@ -7030,6 +7041,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orphaned_process_group.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osf_utimes.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pause.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pc.Po@am__quote@
@@ -9128,6 +9140,9 @@
 $(srcdir)/openat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
+$(srcdir)/orphaned_process_group.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
+	$(AM_V_GEN) $^ $@
+
 $(srcdir)/osf_utimes.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
Index: strace-4.24/tests-mx32/Makefile.in
===================================================================
--- strace-4.24.orig/tests-mx32/Makefile.in	2019-03-10 05:45:49.892553217 +0100
+++ strace-4.24/tests-mx32/Makefile.in	2019-03-10 05:57:19.939643305 +0100
@@ -161,8 +161,8 @@
 	net-tpacket_stats-success$(EXEEXT) netlink_inet_diag$(EXEEXT) \
 	netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \
 	nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \
-	oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \
-	perf_event_open_nonverbose$(EXEEXT) \
+	oldselect-efault-P$(EXEEXT) orphaned_process_group$(EXEEXT) \
+	pc$(EXEEXT) perf_event_open_nonverbose$(EXEEXT) \
 	perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \
 	prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \
 	prctl-spec-inject$(EXEEXT) print_maxfd$(EXEEXT) \
@@ -1743,6 +1743,10 @@
 openat_OBJECTS = openat.$(OBJEXT)
 openat_LDADD = $(LDADD)
 openat_DEPENDENCIES = libtests.a
+orphaned_process_group_SOURCES = orphaned_process_group.c
+orphaned_process_group_OBJECTS = orphaned_process_group.$(OBJEXT)
+orphaned_process_group_LDADD = $(LDADD)
+orphaned_process_group_DEPENDENCIES = libtests.a
 osf_utimes_SOURCES = osf_utimes.c
 osf_utimes_OBJECTS = osf_utimes.$(OBJEXT)
 osf_utimes_LDADD = $(LDADD)
@@ -2786,7 +2790,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -2931,7 +2936,8 @@
 	old_mmap-P.c old_mmap-Xabbrev.c old_mmap-Xraw.c \
 	old_mmap-Xverbose.c old_mmap-v-none.c oldfstat.c oldlstat.c \
 	oldselect.c oldselect-P.c oldselect-efault.c \
-	oldselect-efault-P.c oldstat.c open.c openat.c osf_utimes.c \
+	oldselect-efault-P.c oldstat.c open.c openat.c \
+	orphaned_process_group.c osf_utimes.c \
 	pause.c pc.c perf_event_open.c perf_event_open_nonverbose.c \
 	perf_event_open_unabbrev.c personality.c personality-Xabbrev.c \
 	personality-Xraw.c personality-Xverbose.c pipe.c pipe2.c \
@@ -4058,7 +4064,8 @@
 	oldselect.gen.test oldselect-P.gen.test \
 	oldselect-efault.gen.test oldselect-efault-P.gen.test \
 	oldstat.gen.test open.gen.test openat.gen.test \
-	osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \
+	orphaned_process_group.gen.test osf_utimes.gen.test \
+	pause.gen.test perf_event_open.gen.test \
 	perf_event_open_nonverbose.gen.test \
 	perf_event_open_unabbrev.gen.test personality-Xabbrev.gen.test \
 	personality-Xraw.gen.test personality-Xverbose.gen.test \
@@ -5752,6 +5759,10 @@
 	@rm -f openat$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(openat_OBJECTS) $(openat_LDADD) $(LIBS)
 
+orphaned_process_group$(EXEEXT): $(orphaned_process_group_OBJECTS) $(orphaned_process_group_DEPENDENCIES) $(EXTRA_orphaned_process_group_DEPENDENCIES) 
+	@rm -f orphaned_process_group$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(orphaned_process_group_OBJECTS) $(orphaned_process_group_LDADD) $(LIBS)
+
 osf_utimes$(EXEEXT): $(osf_utimes_OBJECTS) $(osf_utimes_DEPENDENCIES) $(EXTRA_osf_utimes_DEPENDENCIES) 
 	@rm -f osf_utimes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(osf_utimes_OBJECTS) $(osf_utimes_LDADD) $(LIBS)
@@ -7030,6 +7041,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orphaned_process_group.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osf_utimes.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pause.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pc.Po@am__quote@
@@ -9128,6 +9140,9 @@
 $(srcdir)/openat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
+$(srcdir)/orphaned_process_group.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
+	$(AM_V_GEN) $^ $@
+
 $(srcdir)/osf_utimes.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
 	$(AM_V_GEN) $^ $@
 
Index: strace-4.24/tests-m32/orphaned_process_group.gen.test
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests-m32/orphaned_process_group.gen.test	2019-03-10 05:59:50.567134970 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh -efu
+# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (orphaned_process_group . "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'); do not edit.
+. "${srcdir=.}/init.sh"
+. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
Index: strace-4.24/tests-mx32/orphaned_process_group.gen.test
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests-mx32/orphaned_process_group.gen.test	2019-03-10 05:59:51.671123915 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh -efu
+# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (orphaned_process_group . "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'); do not edit.
+. "${srcdir=.}/init.sh"
+. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
Index: strace-4.24/tests/orphaned_process_group.gen.test
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace-4.24/tests/orphaned_process_group.gen.test	2019-03-10 05:59:48.722153445 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh -efu
+# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (orphaned_process_group . "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'); do not edit.
+. "${srcdir=.}/init.sh"
+. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
Index: strace-4.24/tests-m32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-m32/gen_tests.in	2018-08-01 16:57:16.000000000 +0200
+++ strace-4.24/tests-m32/gen_tests.in	2019-03-10 06:00:59.151448188 +0100
@@ -3,27 +3,7 @@
 # Copyright (c) 2017-2018 The strace developers.
 # All rights reserved.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-#    derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 _newselect
 _newselect-P	 -e trace=_newselect -P /dev/full 9>>/dev/full
@@ -307,6 +287,7 @@
 oldstat	-a32 -v -P stat.sample -P /dev/full
 open	-a30 -P $NAME.sample
 openat	-a36 -P $NAME.sample
+orphaned_process_group	. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
 osf_utimes	-a21
 pause	-a8 -esignal=none
 perf_event_open	-a1
Index: strace-4.24/tests-mx32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-mx32/gen_tests.in	2018-08-01 16:57:16.000000000 +0200
+++ strace-4.24/tests-mx32/gen_tests.in	2019-03-10 06:01:00.297436713 +0100
@@ -3,27 +3,7 @@
 # Copyright (c) 2017-2018 The strace developers.
 # All rights reserved.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-#    derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 _newselect
 _newselect-P	 -e trace=_newselect -P /dev/full 9>>/dev/full
@@ -307,6 +287,7 @@
 oldstat	-a32 -v -P stat.sample -P /dev/full
 open	-a30 -P $NAME.sample
 openat	-a36 -P $NAME.sample
+orphaned_process_group	. "${srcdir=.}/PTRACE_SEIZE.sh"; run_strace_match_diff -f -e trace=none -e signal='!chld'
 osf_utimes	-a21
 pause	-a8 -esignal=none
 perf_event_open	-a1