Blame SOURCES/0137-Implement-testing-framework-for-pidns.patch

d811e0
From 4362ddaba8634a5ac6b4add0eaf25eec5f7315f5 Mon Sep 17 00:00:00 2001
d811e0
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
d811e0
Date: Fri, 26 Jun 2020 20:13:28 +0200
d811e0
Subject: [PATCH 137/138] Implement testing framework for pidns
d811e0
d811e0
* tests/pidns.c: New file.
d811e0
* tests/pidns.h: New file.
d811e0
* tests/Makefile.am (libtests_a_SOURCES): Add pidns.c, pidns.h.
d811e0
* tests/init.sh (test_pidns, test_pidns_run_strace): New functions.
d811e0
---
d811e0
 tests/Makefile.am |   2 +
d811e0
 tests/init.sh     |  30 +++++++
d811e0
 tests/pidns.c     | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
d811e0
 tests/pidns.h     |  56 +++++++++++++
d811e0
 4 files changed, 325 insertions(+)
d811e0
 create mode 100644 tests/pidns.c
d811e0
 create mode 100644 tests/pidns.h
d811e0
d811e0
Index: strace-5.7/tests/Makefile.am
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests/Makefile.am	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests/Makefile.am	2020-09-09 19:49:54.008575349 +0200
d811e0
@@ -44,6 +44,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
Index: strace-5.7/tests/init.sh
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests/init.sh	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests/init.sh	2020-09-09 19:49:54.008575349 +0200
d811e0
@@ -387,6 +387,36 @@
d811e0
 	test_pure_prog_set "$@" < "$srcdir/$NAME.in"
d811e0
 }
d811e0
 
d811e0
+test_pidns_run_strace()
d811e0
+{
d811e0
+	local parent_pid init_pid
d811e0
+
d811e0
+	check_prog tail
d811e0
+	check_prog cut
d811e0
+	check_prog grep
d811e0
+
d811e0
+	run_prog > /dev/null
d811e0
+	run_strace --pidns-translation -f $@ $args > "$EXP"
d811e0
+
d811e0
+	# filter out logs made by the parent or init process of the pidns test
d811e0
+	parent_pid="$(tail -n 2 $LOG | head -n 1 | cut -d' ' -f1)"
d811e0
+	init_pid="$(tail -n 1 $LOG | cut -d' ' -f1)"
d811e0
+	grep -E -v "^($parent_pid|$init_pid) " "$LOG" > "$OUT"
d811e0
+	match_diff "$OUT" "$EXP"
d811e0
+}
d811e0
+
d811e0
+test_pidns()
d811e0
+{
d811e0
+	check_prog unshare
d811e0
+	unshare -Urpf true || framework_skip_ "unshare -Urpf true failed"
d811e0
+
d811e0
+	test_pidns_run_strace "$@"
d811e0
+
d811e0
+	# test PID translation when /proc is mounted from an other namespace
d811e0
+	STRACE="unshare -Urpf $STRACE"
d811e0
+	test_pidns_run_strace "$@"
d811e0
+}
d811e0
+
d811e0
 check_prog cat
d811e0
 check_prog rm
d811e0
 
d811e0
Index: strace-5.7/tests/pidns.c
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests/pidns.c	2020-09-09 19:49:54.009575350 +0200
d811e0
@@ -0,0 +1,237 @@
d811e0
+/*
d811e0
+ * Testing framework for PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#include "tests.h"
d811e0
+#include "pidns.h"
d811e0
+#include "nsfs.h"
d811e0
+
d811e0
+#include <errno.h>
d811e0
+#include <stdio.h>
d811e0
+#include <string.h>
d811e0
+#include <sys/types.h>
d811e0
+#include <signal.h>
d811e0
+#include <stdlib.h>
d811e0
+#include <sched.h>
d811e0
+#include <unistd.h>
d811e0
+#include <sys/wait.h>
d811e0
+#include <linux/sched.h>
d811e0
+#include <fcntl.h>
d811e0
+#include <sys/ioctl.h>
d811e0
+
d811e0
+#ifndef CLONE_NEWUSER
d811e0
+# define CLONE_NEWUSER 0x10000000
d811e0
+#endif
d811e0
+
d811e0
+#ifndef CLONE_NEWPID
d811e0
+# define CLONE_NEWPID 0x20000000
d811e0
+#endif
d811e0
+
d811e0
+static bool pidns_translation = false;
d811e0
+static bool pidns_unshared = false;
d811e0
+
d811e0
+/* Our PIDs in strace's namespace */
d811e0
+static pid_t pidns_strace_ids[PT_COUNT];
d811e0
+
d811e0
+void
d811e0
+pidns_print_leader(void)
d811e0
+{
d811e0
+	if (pidns_translation)
d811e0
+		printf("%-5d ", pidns_strace_ids[PT_TID]);
d811e0
+}
d811e0
+
d811e0
+const char *
d811e0
+pidns_pid2str(enum pid_type type)
d811e0
+{
d811e0
+	static const char format[] = " /* %d in strace's PID NS */";
d811e0
+	static char buf[PT_COUNT][sizeof(format) + sizeof(int) * 3];
d811e0
+
d811e0
+	if (type < 0 || type >= PT_COUNT)
d811e0
+		return "";
d811e0
+
d811e0
+	if (!pidns_unshared || !pidns_strace_ids[type])
d811e0
+		return "";
d811e0
+
d811e0
+	snprintf(buf[type], sizeof(buf[type]), format, pidns_strace_ids[type]);
d811e0
+	return buf[type];
d811e0
+}
d811e0
+
d811e0
+/**
d811e0
+ * This function is like fork, but does a few more things. It sets up the
d811e0
+ * child's PGID and SID according to the parameters. Also it fills the
d811e0
+ * pidns_strace_ids array in the child's memory with the PIDs of the child in
d811e0
+ * parent's PID namespace. In the parent it waits for the child to terminate
d811e0
+ * (but leaves the zombie to use it later as a process group). If the child
d811e0
+ * terminates with nonzero exit status, the test is failed.
d811e0
+ *
d811e0
+ * @param pgid     The process group the child should be moved to. It's expected
d811e0
+ *                 to be a PID of a zombie process (will be reaped). If
d811e0
+ *                 negative, leave the child in the process group of the parent.
d811e0
+ *                 If 0, move the process to its own process group.
d811e0
+ * @param new_sid  Wheather child should be moved to a new session.
d811e0
+ */
d811e0
+static pid_t
d811e0
+pidns_fork(pid_t pgid, bool new_sid)
d811e0
+{
d811e0
+	int strace_ids_pipe[2];
d811e0
+	if (pipe(strace_ids_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	fflush(stdout);
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(strace_ids_pipe[1]);
d811e0
+
d811e0
+		ssize_t len = read(strace_ids_pipe[0], pidns_strace_ids,
d811e0
+				sizeof(pidns_strace_ids));
d811e0
+		if (len < 0)
d811e0
+			perror_msg_and_fail("read");
d811e0
+		if (len != sizeof(pidns_strace_ids))
d811e0
+			error_msg_and_fail("read returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+		close(strace_ids_pipe[0]);
d811e0
+
d811e0
+		if (pidns_strace_ids[PT_SID])
d811e0
+			setsid();
d811e0
+
d811e0
+		return 0;
d811e0
+	}
d811e0
+
d811e0
+	pidns_strace_ids[PT_TID] = pid;
d811e0
+	pidns_strace_ids[PT_TGID] = pid;
d811e0
+	pidns_strace_ids[PT_PGID] = 0;
d811e0
+	pidns_strace_ids[PT_SID] = 0;
d811e0
+
d811e0
+	if (!pgid)
d811e0
+		pgid = pid;
d811e0
+
d811e0
+	if (pgid > 0) {
d811e0
+		if (setpgid(pid, pgid) < 0)
d811e0
+			perror_msg_and_fail("setpgid");
d811e0
+
d811e0
+		pidns_strace_ids[PT_PGID] = pgid;
d811e0
+	}
d811e0
+
d811e0
+	/* Reap group leader to test PGID decoding */
d811e0
+	if (pgid > 0 && pgid != pid) {
d811e0
+		int ret = waitpid(pgid, NULL, WNOHANG);
d811e0
+		if (ret < 0)
d811e0
+			perror_msg_and_fail("wait");
d811e0
+		if (!ret)
d811e0
+			error_msg_and_fail("could not reap group leader");
d811e0
+	}
d811e0
+
d811e0
+	if (new_sid) {
d811e0
+		pidns_strace_ids[PT_SID] = pid;
d811e0
+		pidns_strace_ids[PT_PGID] = pid;
d811e0
+	}
d811e0
+
d811e0
+	ssize_t len = write(strace_ids_pipe[1], pidns_strace_ids,
d811e0
+	                     sizeof(pidns_strace_ids));
d811e0
+	if (len < 0)
d811e0
+		perror_msg_and_fail("write");
d811e0
+	if (len != sizeof(pidns_strace_ids))
d811e0
+		error_msg_and_fail("write returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+	close(strace_ids_pipe[0]);
d811e0
+	close(strace_ids_pipe[1]);
d811e0
+
d811e0
+	/* WNOWAIT: leave the zombie, to be able to use it as a process group */
d811e0
+	siginfo_t siginfo;
d811e0
+	if (waitid(P_PID, pid, &siginfo, WEXITED | WNOWAIT) < 0)
d811e0
+		perror_msg_and_fail("wait");
d811e0
+	if (siginfo.si_code != CLD_EXITED || siginfo.si_status)
d811e0
+		error_msg_and_fail("child terminated with nonzero exit status");
d811e0
+
d811e0
+	return pid;
d811e0
+}
d811e0
+
d811e0
+static void
d811e0
+create_init_process(void)
d811e0
+{
d811e0
+	int child_pipe[2];
d811e0
+	if (pipe(child_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(child_pipe[1]);
d811e0
+		if (read(child_pipe[0], &child_pipe[1], sizeof(int)) != 0)
d811e0
+			_exit(1);
d811e0
+		_exit(0);
d811e0
+	}
d811e0
+
d811e0
+	close(child_pipe[0]);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+check_ns_ioctl(void)
d811e0
+{
d811e0
+	int fd = open("/proc/self/ns/pid", O_RDONLY);
d811e0
+	if (fd < 0) {
d811e0
+		if (errno == ENOENT)
d811e0
+			perror_msg_and_skip("opening /proc/self/ns/pid");
d811e0
+		else
d811e0
+			perror_msg_and_fail("opening /proc/self/ns/pid");
d811e0
+	}
d811e0
+
d811e0
+	int userns_fd = ioctl(fd, NS_GET_USERNS);
d811e0
+	if (userns_fd < 0) {
d811e0
+		if (errno == ENOTTY)
d811e0
+			error_msg_and_skip("NS_* ioctl commands are not "
d811e0
+			                   "supported by the kernel");
d811e0
+		else
d811e0
+			perror_msg_and_fail("ioctl(NS_GET_USERNS)");
d811e0
+	}
d811e0
+
d811e0
+	close(userns_fd);
d811e0
+	close(fd);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+pidns_test_init(void)
d811e0
+{
d811e0
+	pidns_translation = true;
d811e0
+
d811e0
+	check_ns_ioctl();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	/* Unshare user namespace too, so we do not need to be root */
d811e0
+	if (unshare(CLONE_NEWUSER | CLONE_NEWPID) < 0) {
d811e0
+		if (errno == EPERM)
d811e0
+			perror_msg_and_skip("unshare");
d811e0
+
d811e0
+		perror_msg_and_fail("unshare");
d811e0
+	}
d811e0
+
d811e0
+	pidns_unshared = true;
d811e0
+
d811e0
+	create_init_process();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(-1, true))
d811e0
+		return;
d811e0
+
d811e0
+	pid_t pgid;
d811e0
+	if (!(pgid = pidns_fork(0, false)))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(pgid, false))
d811e0
+		return;
d811e0
+
d811e0
+	exit(0);
d811e0
+}
d811e0
Index: strace-5.7/tests/pidns.h
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests/pidns.h	2020-09-09 19:49:54.009575350 +0200
d811e0
@@ -0,0 +1,56 @@
d811e0
+/*
d811e0
+ * Test PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#ifndef STRACE_PIDNS_H
d811e0
+#define STRACE_PIDNS_H
d811e0
+
d811e0
+#ifdef PIDNS_TRANSLATION
d811e0
+# define PIDNS_TEST_INIT pidns_test_init()
d811e0
+#else
d811e0
+# define PIDNS_TEST_INIT
d811e0
+#endif
d811e0
+
d811e0
+#include <sys/types.h>
d811e0
+
d811e0
+enum pid_type {
d811e0
+	PT_TID,
d811e0
+	PT_TGID,
d811e0
+	PT_PGID,
d811e0
+	PT_SID,
d811e0
+
d811e0
+	PT_COUNT,
d811e0
+	PT_NONE = -1
d811e0
+};
d811e0
+
d811e0
+/* Prints leader (process tid) if pidns_test_init was called */
d811e0
+void pidns_print_leader(void);
d811e0
+
d811e0
+/*
d811e0
+ * Returns a static buffer containing the translation string of our PID.
d811e0
+ */
d811e0
+const char *pidns_pid2str(enum pid_type type);
d811e0
+
d811e0
+/**
d811e0
+ * Skips the test if NS_* ioctl commands are not supported by the kernel.
d811e0
+ */
d811e0
+void check_ns_ioctl(void);
d811e0
+
d811e0
+/**
d811e0
+ * Init pidns testing.
d811e0
+ *
d811e0
+ * Should be called at the beginning of the test's main function
d811e0
+ *
d811e0
+ * This function calls fork a couple of times, and returns in the child
d811e0
+ * processes. These child processes are in a new PID namespace with different
d811e0
+ * PID configurations (group leader, session leader, ...). If any child
d811e0
+ * terminates with nonzero exit status the test is failed. Otherwise the test is
d811e0
+ * succesful, and the parent process exits with 0.
d811e0
+ */
d811e0
+void pidns_test_init(void);
d811e0
+
d811e0
+#endif
d811e0
\ No newline at end of file
d811e0
Index: strace-5.7/tests-m32/Makefile.am
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-m32/Makefile.am	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests-m32/Makefile.am	2020-09-09 19:49:54.009575350 +0200
d811e0
@@ -7,14 +7,14 @@
d811e0
 # SPDX-License-Identifier: GPL-2.0-or-later
d811e0
 
d811e0
 OS = linux
d811e0
-CC = @CC_FOR_M32@
d811e0
-ARCH = @arch_m32@
d811e0
+CC = @CC@
d811e0
+ARCH = @arch@
d811e0
 NATIVE_ARCH = @arch_native@
d811e0
-SIZEOF_KERNEL_LONG_T = 4
d811e0
-SIZEOF_LONG = 4
d811e0
-MPERS_NAME = m32
d811e0
-MPERS_CC_FLAGS = @CFLAGS_FOR_M32@ @cc_flags_m32@
d811e0
-ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS)
d811e0
+SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@
d811e0
+SIZEOF_LONG = @SIZEOF_LONG@
d811e0
+MPERS_NAME =
d811e0
+MPERS_CC_FLAGS =
d811e0
+ARCH_MFLAGS =
d811e0
 AM_CFLAGS = $(WARN_CFLAGS)
d811e0
 AM_CPPFLAGS = $(ARCH_MFLAGS) \
d811e0
 	      -I$(builddir) \
d811e0
@@ -44,6 +44,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
Index: strace-5.7/tests-m32/init.sh
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-m32/init.sh	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests-m32/init.sh	2020-09-09 19:49:54.009575350 +0200
d811e0
@@ -387,6 +387,36 @@
d811e0
 	test_pure_prog_set "$@" < "$srcdir/$NAME.in"
d811e0
 }
d811e0
 
d811e0
+test_pidns_run_strace()
d811e0
+{
d811e0
+	local parent_pid init_pid
d811e0
+
d811e0
+	check_prog tail
d811e0
+	check_prog cut
d811e0
+	check_prog grep
d811e0
+
d811e0
+	run_prog > /dev/null
d811e0
+	run_strace --pidns-translation -f $@ $args > "$EXP"
d811e0
+
d811e0
+	# filter out logs made by the parent or init process of the pidns test
d811e0
+	parent_pid="$(tail -n 2 $LOG | head -n 1 | cut -d' ' -f1)"
d811e0
+	init_pid="$(tail -n 1 $LOG | cut -d' ' -f1)"
d811e0
+	grep -E -v "^($parent_pid|$init_pid) " "$LOG" > "$OUT"
d811e0
+	match_diff "$OUT" "$EXP"
d811e0
+}
d811e0
+
d811e0
+test_pidns()
d811e0
+{
d811e0
+	check_prog unshare
d811e0
+	unshare -Urpf true || framework_skip_ "unshare -Urpf true failed"
d811e0
+
d811e0
+	test_pidns_run_strace "$@"
d811e0
+
d811e0
+	# test PID translation when /proc is mounted from an other namespace
d811e0
+	STRACE="unshare -Urpf $STRACE"
d811e0
+	test_pidns_run_strace "$@"
d811e0
+}
d811e0
+
d811e0
 check_prog cat
d811e0
 check_prog rm
d811e0
 
d811e0
Index: strace-5.7/tests-m32/pidns.c
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests-m32/pidns.c	2020-09-09 19:49:54.009575350 +0200
d811e0
@@ -0,0 +1,237 @@
d811e0
+/*
d811e0
+ * Testing framework for PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#include "tests.h"
d811e0
+#include "pidns.h"
d811e0
+#include "nsfs.h"
d811e0
+
d811e0
+#include <errno.h>
d811e0
+#include <stdio.h>
d811e0
+#include <string.h>
d811e0
+#include <sys/types.h>
d811e0
+#include <signal.h>
d811e0
+#include <stdlib.h>
d811e0
+#include <sched.h>
d811e0
+#include <unistd.h>
d811e0
+#include <sys/wait.h>
d811e0
+#include <linux/sched.h>
d811e0
+#include <fcntl.h>
d811e0
+#include <sys/ioctl.h>
d811e0
+
d811e0
+#ifndef CLONE_NEWUSER
d811e0
+# define CLONE_NEWUSER 0x10000000
d811e0
+#endif
d811e0
+
d811e0
+#ifndef CLONE_NEWPID
d811e0
+# define CLONE_NEWPID 0x20000000
d811e0
+#endif
d811e0
+
d811e0
+static bool pidns_translation = false;
d811e0
+static bool pidns_unshared = false;
d811e0
+
d811e0
+/* Our PIDs in strace's namespace */
d811e0
+static pid_t pidns_strace_ids[PT_COUNT];
d811e0
+
d811e0
+void
d811e0
+pidns_print_leader(void)
d811e0
+{
d811e0
+	if (pidns_translation)
d811e0
+		printf("%-5d ", pidns_strace_ids[PT_TID]);
d811e0
+}
d811e0
+
d811e0
+const char *
d811e0
+pidns_pid2str(enum pid_type type)
d811e0
+{
d811e0
+	static const char format[] = " /* %d in strace's PID NS */";
d811e0
+	static char buf[PT_COUNT][sizeof(format) + sizeof(int) * 3];
d811e0
+
d811e0
+	if (type < 0 || type >= PT_COUNT)
d811e0
+		return "";
d811e0
+
d811e0
+	if (!pidns_unshared || !pidns_strace_ids[type])
d811e0
+		return "";
d811e0
+
d811e0
+	snprintf(buf[type], sizeof(buf[type]), format, pidns_strace_ids[type]);
d811e0
+	return buf[type];
d811e0
+}
d811e0
+
d811e0
+/**
d811e0
+ * This function is like fork, but does a few more things. It sets up the
d811e0
+ * child's PGID and SID according to the parameters. Also it fills the
d811e0
+ * pidns_strace_ids array in the child's memory with the PIDs of the child in
d811e0
+ * parent's PID namespace. In the parent it waits for the child to terminate
d811e0
+ * (but leaves the zombie to use it later as a process group). If the child
d811e0
+ * terminates with nonzero exit status, the test is failed.
d811e0
+ *
d811e0
+ * @param pgid     The process group the child should be moved to. It's expected
d811e0
+ *                 to be a PID of a zombie process (will be reaped). If
d811e0
+ *                 negative, leave the child in the process group of the parent.
d811e0
+ *                 If 0, move the process to its own process group.
d811e0
+ * @param new_sid  Wheather child should be moved to a new session.
d811e0
+ */
d811e0
+static pid_t
d811e0
+pidns_fork(pid_t pgid, bool new_sid)
d811e0
+{
d811e0
+	int strace_ids_pipe[2];
d811e0
+	if (pipe(strace_ids_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	fflush(stdout);
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(strace_ids_pipe[1]);
d811e0
+
d811e0
+		ssize_t len = read(strace_ids_pipe[0], pidns_strace_ids,
d811e0
+				sizeof(pidns_strace_ids));
d811e0
+		if (len < 0)
d811e0
+			perror_msg_and_fail("read");
d811e0
+		if (len != sizeof(pidns_strace_ids))
d811e0
+			error_msg_and_fail("read returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+		close(strace_ids_pipe[0]);
d811e0
+
d811e0
+		if (pidns_strace_ids[PT_SID])
d811e0
+			setsid();
d811e0
+
d811e0
+		return 0;
d811e0
+	}
d811e0
+
d811e0
+	pidns_strace_ids[PT_TID] = pid;
d811e0
+	pidns_strace_ids[PT_TGID] = pid;
d811e0
+	pidns_strace_ids[PT_PGID] = 0;
d811e0
+	pidns_strace_ids[PT_SID] = 0;
d811e0
+
d811e0
+	if (!pgid)
d811e0
+		pgid = pid;
d811e0
+
d811e0
+	if (pgid > 0) {
d811e0
+		if (setpgid(pid, pgid) < 0)
d811e0
+			perror_msg_and_fail("setpgid");
d811e0
+
d811e0
+		pidns_strace_ids[PT_PGID] = pgid;
d811e0
+	}
d811e0
+
d811e0
+	/* Reap group leader to test PGID decoding */
d811e0
+	if (pgid > 0 && pgid != pid) {
d811e0
+		int ret = waitpid(pgid, NULL, WNOHANG);
d811e0
+		if (ret < 0)
d811e0
+			perror_msg_and_fail("wait");
d811e0
+		if (!ret)
d811e0
+			error_msg_and_fail("could not reap group leader");
d811e0
+	}
d811e0
+
d811e0
+	if (new_sid) {
d811e0
+		pidns_strace_ids[PT_SID] = pid;
d811e0
+		pidns_strace_ids[PT_PGID] = pid;
d811e0
+	}
d811e0
+
d811e0
+	ssize_t len = write(strace_ids_pipe[1], pidns_strace_ids,
d811e0
+	                     sizeof(pidns_strace_ids));
d811e0
+	if (len < 0)
d811e0
+		perror_msg_and_fail("write");
d811e0
+	if (len != sizeof(pidns_strace_ids))
d811e0
+		error_msg_and_fail("write returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+	close(strace_ids_pipe[0]);
d811e0
+	close(strace_ids_pipe[1]);
d811e0
+
d811e0
+	/* WNOWAIT: leave the zombie, to be able to use it as a process group */
d811e0
+	siginfo_t siginfo;
d811e0
+	if (waitid(P_PID, pid, &siginfo, WEXITED | WNOWAIT) < 0)
d811e0
+		perror_msg_and_fail("wait");
d811e0
+	if (siginfo.si_code != CLD_EXITED || siginfo.si_status)
d811e0
+		error_msg_and_fail("child terminated with nonzero exit status");
d811e0
+
d811e0
+	return pid;
d811e0
+}
d811e0
+
d811e0
+static void
d811e0
+create_init_process(void)
d811e0
+{
d811e0
+	int child_pipe[2];
d811e0
+	if (pipe(child_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(child_pipe[1]);
d811e0
+		if (read(child_pipe[0], &child_pipe[1], sizeof(int)) != 0)
d811e0
+			_exit(1);
d811e0
+		_exit(0);
d811e0
+	}
d811e0
+
d811e0
+	close(child_pipe[0]);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+check_ns_ioctl(void)
d811e0
+{
d811e0
+	int fd = open("/proc/self/ns/pid", O_RDONLY);
d811e0
+	if (fd < 0) {
d811e0
+		if (errno == ENOENT)
d811e0
+			perror_msg_and_skip("opening /proc/self/ns/pid");
d811e0
+		else
d811e0
+			perror_msg_and_fail("opening /proc/self/ns/pid");
d811e0
+	}
d811e0
+
d811e0
+	int userns_fd = ioctl(fd, NS_GET_USERNS);
d811e0
+	if (userns_fd < 0) {
d811e0
+		if (errno == ENOTTY)
d811e0
+			error_msg_and_skip("NS_* ioctl commands are not "
d811e0
+			                   "supported by the kernel");
d811e0
+		else
d811e0
+			perror_msg_and_fail("ioctl(NS_GET_USERNS)");
d811e0
+	}
d811e0
+
d811e0
+	close(userns_fd);
d811e0
+	close(fd);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+pidns_test_init(void)
d811e0
+{
d811e0
+	pidns_translation = true;
d811e0
+
d811e0
+	check_ns_ioctl();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	/* Unshare user namespace too, so we do not need to be root */
d811e0
+	if (unshare(CLONE_NEWUSER | CLONE_NEWPID) < 0) {
d811e0
+		if (errno == EPERM)
d811e0
+			perror_msg_and_skip("unshare");
d811e0
+
d811e0
+		perror_msg_and_fail("unshare");
d811e0
+	}
d811e0
+
d811e0
+	pidns_unshared = true;
d811e0
+
d811e0
+	create_init_process();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(-1, true))
d811e0
+		return;
d811e0
+
d811e0
+	pid_t pgid;
d811e0
+	if (!(pgid = pidns_fork(0, false)))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(pgid, false))
d811e0
+		return;
d811e0
+
d811e0
+	exit(0);
d811e0
+}
d811e0
Index: strace-5.7/tests-m32/pidns.h
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests-m32/pidns.h	2020-09-09 19:49:54.010575350 +0200
d811e0
@@ -0,0 +1,56 @@
d811e0
+/*
d811e0
+ * Test PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#ifndef STRACE_PIDNS_H
d811e0
+#define STRACE_PIDNS_H
d811e0
+
d811e0
+#ifdef PIDNS_TRANSLATION
d811e0
+# define PIDNS_TEST_INIT pidns_test_init()
d811e0
+#else
d811e0
+# define PIDNS_TEST_INIT
d811e0
+#endif
d811e0
+
d811e0
+#include <sys/types.h>
d811e0
+
d811e0
+enum pid_type {
d811e0
+	PT_TID,
d811e0
+	PT_TGID,
d811e0
+	PT_PGID,
d811e0
+	PT_SID,
d811e0
+
d811e0
+	PT_COUNT,
d811e0
+	PT_NONE = -1
d811e0
+};
d811e0
+
d811e0
+/* Prints leader (process tid) if pidns_test_init was called */
d811e0
+void pidns_print_leader(void);
d811e0
+
d811e0
+/*
d811e0
+ * Returns a static buffer containing the translation string of our PID.
d811e0
+ */
d811e0
+const char *pidns_pid2str(enum pid_type type);
d811e0
+
d811e0
+/**
d811e0
+ * Skips the test if NS_* ioctl commands are not supported by the kernel.
d811e0
+ */
d811e0
+void check_ns_ioctl(void);
d811e0
+
d811e0
+/**
d811e0
+ * Init pidns testing.
d811e0
+ *
d811e0
+ * Should be called at the beginning of the test's main function
d811e0
+ *
d811e0
+ * This function calls fork a couple of times, and returns in the child
d811e0
+ * processes. These child processes are in a new PID namespace with different
d811e0
+ * PID configurations (group leader, session leader, ...). If any child
d811e0
+ * terminates with nonzero exit status the test is failed. Otherwise the test is
d811e0
+ * succesful, and the parent process exits with 0.
d811e0
+ */
d811e0
+void pidns_test_init(void);
d811e0
+
d811e0
+#endif
d811e0
\ No newline at end of file
d811e0
Index: strace-5.7/tests-mx32/Makefile.am
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-mx32/Makefile.am	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests-mx32/Makefile.am	2020-09-09 19:49:54.010575350 +0200
d811e0
@@ -7,14 +7,14 @@
d811e0
 # SPDX-License-Identifier: GPL-2.0-or-later
d811e0
 
d811e0
 OS = linux
d811e0
-CC = @CC_FOR_MX32@
d811e0
-ARCH = @arch_mx32@
d811e0
+CC = @CC@
d811e0
+ARCH = @arch@
d811e0
 NATIVE_ARCH = @arch_native@
d811e0
 SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@
d811e0
-SIZEOF_LONG = 4
d811e0
-MPERS_NAME = mx32
d811e0
-MPERS_CC_FLAGS = @CFLAGS_FOR_MX32@ @cc_flags_mx32@
d811e0
-ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS)
d811e0
+SIZEOF_LONG = @SIZEOF_LONG@
d811e0
+MPERS_NAME =
d811e0
+MPERS_CC_FLAGS =
d811e0
+ARCH_MFLAGS =
d811e0
 AM_CFLAGS = $(WARN_CFLAGS)
d811e0
 AM_CPPFLAGS = $(ARCH_MFLAGS) \
d811e0
 	      -I$(builddir) \
d811e0
@@ -44,6 +44,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
Index: strace-5.7/tests-mx32/init.sh
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-mx32/init.sh	2020-09-09 19:32:50.846965498 +0200
d811e0
+++ strace-5.7/tests-mx32/init.sh	2020-09-09 19:49:54.010575350 +0200
d811e0
@@ -387,6 +387,36 @@
d811e0
 	test_pure_prog_set "$@" < "$srcdir/$NAME.in"
d811e0
 }
d811e0
 
d811e0
+test_pidns_run_strace()
d811e0
+{
d811e0
+	local parent_pid init_pid
d811e0
+
d811e0
+	check_prog tail
d811e0
+	check_prog cut
d811e0
+	check_prog grep
d811e0
+
d811e0
+	run_prog > /dev/null
d811e0
+	run_strace --pidns-translation -f $@ $args > "$EXP"
d811e0
+
d811e0
+	# filter out logs made by the parent or init process of the pidns test
d811e0
+	parent_pid="$(tail -n 2 $LOG | head -n 1 | cut -d' ' -f1)"
d811e0
+	init_pid="$(tail -n 1 $LOG | cut -d' ' -f1)"
d811e0
+	grep -E -v "^($parent_pid|$init_pid) " "$LOG" > "$OUT"
d811e0
+	match_diff "$OUT" "$EXP"
d811e0
+}
d811e0
+
d811e0
+test_pidns()
d811e0
+{
d811e0
+	check_prog unshare
d811e0
+	unshare -Urpf true || framework_skip_ "unshare -Urpf true failed"
d811e0
+
d811e0
+	test_pidns_run_strace "$@"
d811e0
+
d811e0
+	# test PID translation when /proc is mounted from an other namespace
d811e0
+	STRACE="unshare -Urpf $STRACE"
d811e0
+	test_pidns_run_strace "$@"
d811e0
+}
d811e0
+
d811e0
 check_prog cat
d811e0
 check_prog rm
d811e0
 
d811e0
Index: strace-5.7/tests-mx32/pidns.c
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests-mx32/pidns.c	2020-09-09 19:49:54.010575350 +0200
d811e0
@@ -0,0 +1,237 @@
d811e0
+/*
d811e0
+ * Testing framework for PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#include "tests.h"
d811e0
+#include "pidns.h"
d811e0
+#include "nsfs.h"
d811e0
+
d811e0
+#include <errno.h>
d811e0
+#include <stdio.h>
d811e0
+#include <string.h>
d811e0
+#include <sys/types.h>
d811e0
+#include <signal.h>
d811e0
+#include <stdlib.h>
d811e0
+#include <sched.h>
d811e0
+#include <unistd.h>
d811e0
+#include <sys/wait.h>
d811e0
+#include <linux/sched.h>
d811e0
+#include <fcntl.h>
d811e0
+#include <sys/ioctl.h>
d811e0
+
d811e0
+#ifndef CLONE_NEWUSER
d811e0
+# define CLONE_NEWUSER 0x10000000
d811e0
+#endif
d811e0
+
d811e0
+#ifndef CLONE_NEWPID
d811e0
+# define CLONE_NEWPID 0x20000000
d811e0
+#endif
d811e0
+
d811e0
+static bool pidns_translation = false;
d811e0
+static bool pidns_unshared = false;
d811e0
+
d811e0
+/* Our PIDs in strace's namespace */
d811e0
+static pid_t pidns_strace_ids[PT_COUNT];
d811e0
+
d811e0
+void
d811e0
+pidns_print_leader(void)
d811e0
+{
d811e0
+	if (pidns_translation)
d811e0
+		printf("%-5d ", pidns_strace_ids[PT_TID]);
d811e0
+}
d811e0
+
d811e0
+const char *
d811e0
+pidns_pid2str(enum pid_type type)
d811e0
+{
d811e0
+	static const char format[] = " /* %d in strace's PID NS */";
d811e0
+	static char buf[PT_COUNT][sizeof(format) + sizeof(int) * 3];
d811e0
+
d811e0
+	if (type < 0 || type >= PT_COUNT)
d811e0
+		return "";
d811e0
+
d811e0
+	if (!pidns_unshared || !pidns_strace_ids[type])
d811e0
+		return "";
d811e0
+
d811e0
+	snprintf(buf[type], sizeof(buf[type]), format, pidns_strace_ids[type]);
d811e0
+	return buf[type];
d811e0
+}
d811e0
+
d811e0
+/**
d811e0
+ * This function is like fork, but does a few more things. It sets up the
d811e0
+ * child's PGID and SID according to the parameters. Also it fills the
d811e0
+ * pidns_strace_ids array in the child's memory with the PIDs of the child in
d811e0
+ * parent's PID namespace. In the parent it waits for the child to terminate
d811e0
+ * (but leaves the zombie to use it later as a process group). If the child
d811e0
+ * terminates with nonzero exit status, the test is failed.
d811e0
+ *
d811e0
+ * @param pgid     The process group the child should be moved to. It's expected
d811e0
+ *                 to be a PID of a zombie process (will be reaped). If
d811e0
+ *                 negative, leave the child in the process group of the parent.
d811e0
+ *                 If 0, move the process to its own process group.
d811e0
+ * @param new_sid  Wheather child should be moved to a new session.
d811e0
+ */
d811e0
+static pid_t
d811e0
+pidns_fork(pid_t pgid, bool new_sid)
d811e0
+{
d811e0
+	int strace_ids_pipe[2];
d811e0
+	if (pipe(strace_ids_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	fflush(stdout);
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(strace_ids_pipe[1]);
d811e0
+
d811e0
+		ssize_t len = read(strace_ids_pipe[0], pidns_strace_ids,
d811e0
+				sizeof(pidns_strace_ids));
d811e0
+		if (len < 0)
d811e0
+			perror_msg_and_fail("read");
d811e0
+		if (len != sizeof(pidns_strace_ids))
d811e0
+			error_msg_and_fail("read returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+		close(strace_ids_pipe[0]);
d811e0
+
d811e0
+		if (pidns_strace_ids[PT_SID])
d811e0
+			setsid();
d811e0
+
d811e0
+		return 0;
d811e0
+	}
d811e0
+
d811e0
+	pidns_strace_ids[PT_TID] = pid;
d811e0
+	pidns_strace_ids[PT_TGID] = pid;
d811e0
+	pidns_strace_ids[PT_PGID] = 0;
d811e0
+	pidns_strace_ids[PT_SID] = 0;
d811e0
+
d811e0
+	if (!pgid)
d811e0
+		pgid = pid;
d811e0
+
d811e0
+	if (pgid > 0) {
d811e0
+		if (setpgid(pid, pgid) < 0)
d811e0
+			perror_msg_and_fail("setpgid");
d811e0
+
d811e0
+		pidns_strace_ids[PT_PGID] = pgid;
d811e0
+	}
d811e0
+
d811e0
+	/* Reap group leader to test PGID decoding */
d811e0
+	if (pgid > 0 && pgid != pid) {
d811e0
+		int ret = waitpid(pgid, NULL, WNOHANG);
d811e0
+		if (ret < 0)
d811e0
+			perror_msg_and_fail("wait");
d811e0
+		if (!ret)
d811e0
+			error_msg_and_fail("could not reap group leader");
d811e0
+	}
d811e0
+
d811e0
+	if (new_sid) {
d811e0
+		pidns_strace_ids[PT_SID] = pid;
d811e0
+		pidns_strace_ids[PT_PGID] = pid;
d811e0
+	}
d811e0
+
d811e0
+	ssize_t len = write(strace_ids_pipe[1], pidns_strace_ids,
d811e0
+	                     sizeof(pidns_strace_ids));
d811e0
+	if (len < 0)
d811e0
+		perror_msg_and_fail("write");
d811e0
+	if (len != sizeof(pidns_strace_ids))
d811e0
+		error_msg_and_fail("write returned < sizeof(pidns_strace_ids)");
d811e0
+
d811e0
+	close(strace_ids_pipe[0]);
d811e0
+	close(strace_ids_pipe[1]);
d811e0
+
d811e0
+	/* WNOWAIT: leave the zombie, to be able to use it as a process group */
d811e0
+	siginfo_t siginfo;
d811e0
+	if (waitid(P_PID, pid, &siginfo, WEXITED | WNOWAIT) < 0)
d811e0
+		perror_msg_and_fail("wait");
d811e0
+	if (siginfo.si_code != CLD_EXITED || siginfo.si_status)
d811e0
+		error_msg_and_fail("child terminated with nonzero exit status");
d811e0
+
d811e0
+	return pid;
d811e0
+}
d811e0
+
d811e0
+static void
d811e0
+create_init_process(void)
d811e0
+{
d811e0
+	int child_pipe[2];
d811e0
+	if (pipe(child_pipe) < 0)
d811e0
+		perror_msg_and_fail("pipe");
d811e0
+
d811e0
+	pid_t pid = fork();
d811e0
+	if (pid < 0)
d811e0
+		perror_msg_and_fail("fork");
d811e0
+
d811e0
+	if (!pid) {
d811e0
+		close(child_pipe[1]);
d811e0
+		if (read(child_pipe[0], &child_pipe[1], sizeof(int)) != 0)
d811e0
+			_exit(1);
d811e0
+		_exit(0);
d811e0
+	}
d811e0
+
d811e0
+	close(child_pipe[0]);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+check_ns_ioctl(void)
d811e0
+{
d811e0
+	int fd = open("/proc/self/ns/pid", O_RDONLY);
d811e0
+	if (fd < 0) {
d811e0
+		if (errno == ENOENT)
d811e0
+			perror_msg_and_skip("opening /proc/self/ns/pid");
d811e0
+		else
d811e0
+			perror_msg_and_fail("opening /proc/self/ns/pid");
d811e0
+	}
d811e0
+
d811e0
+	int userns_fd = ioctl(fd, NS_GET_USERNS);
d811e0
+	if (userns_fd < 0) {
d811e0
+		if (errno == ENOTTY)
d811e0
+			error_msg_and_skip("NS_* ioctl commands are not "
d811e0
+			                   "supported by the kernel");
d811e0
+		else
d811e0
+			perror_msg_and_fail("ioctl(NS_GET_USERNS)");
d811e0
+	}
d811e0
+
d811e0
+	close(userns_fd);
d811e0
+	close(fd);
d811e0
+}
d811e0
+
d811e0
+void
d811e0
+pidns_test_init(void)
d811e0
+{
d811e0
+	pidns_translation = true;
d811e0
+
d811e0
+	check_ns_ioctl();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	/* Unshare user namespace too, so we do not need to be root */
d811e0
+	if (unshare(CLONE_NEWUSER | CLONE_NEWPID) < 0) {
d811e0
+		if (errno == EPERM)
d811e0
+			perror_msg_and_skip("unshare");
d811e0
+
d811e0
+		perror_msg_and_fail("unshare");
d811e0
+	}
d811e0
+
d811e0
+	pidns_unshared = true;
d811e0
+
d811e0
+	create_init_process();
d811e0
+
d811e0
+	if (!pidns_fork(-1, false))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(-1, true))
d811e0
+		return;
d811e0
+
d811e0
+	pid_t pgid;
d811e0
+	if (!(pgid = pidns_fork(0, false)))
d811e0
+		return;
d811e0
+
d811e0
+	if (!pidns_fork(pgid, false))
d811e0
+		return;
d811e0
+
d811e0
+	exit(0);
d811e0
+}
d811e0
Index: strace-5.7/tests-mx32/pidns.h
d811e0
===================================================================
d811e0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
d811e0
+++ strace-5.7/tests-mx32/pidns.h	2020-09-09 19:49:54.010575350 +0200
d811e0
@@ -0,0 +1,56 @@
d811e0
+/*
d811e0
+ * Test PID namespace translation
d811e0
+ *
d811e0
+ * Copyright (c) 2020 Ákos Uzonyi <uzonyi.akos@gmail.com>
d811e0
+ * All rights reserved.
d811e0
+ *
d811e0
+ * SPDX-License-Identifier: LGPL-2.1-or-later
d811e0
+ */
d811e0
+#ifndef STRACE_PIDNS_H
d811e0
+#define STRACE_PIDNS_H
d811e0
+
d811e0
+#ifdef PIDNS_TRANSLATION
d811e0
+# define PIDNS_TEST_INIT pidns_test_init()
d811e0
+#else
d811e0
+# define PIDNS_TEST_INIT
d811e0
+#endif
d811e0
+
d811e0
+#include <sys/types.h>
d811e0
+
d811e0
+enum pid_type {
d811e0
+	PT_TID,
d811e0
+	PT_TGID,
d811e0
+	PT_PGID,
d811e0
+	PT_SID,
d811e0
+
d811e0
+	PT_COUNT,
d811e0
+	PT_NONE = -1
d811e0
+};
d811e0
+
d811e0
+/* Prints leader (process tid) if pidns_test_init was called */
d811e0
+void pidns_print_leader(void);
d811e0
+
d811e0
+/*
d811e0
+ * Returns a static buffer containing the translation string of our PID.
d811e0
+ */
d811e0
+const char *pidns_pid2str(enum pid_type type);
d811e0
+
d811e0
+/**
d811e0
+ * Skips the test if NS_* ioctl commands are not supported by the kernel.
d811e0
+ */
d811e0
+void check_ns_ioctl(void);
d811e0
+
d811e0
+/**
d811e0
+ * Init pidns testing.
d811e0
+ *
d811e0
+ * Should be called at the beginning of the test's main function
d811e0
+ *
d811e0
+ * This function calls fork a couple of times, and returns in the child
d811e0
+ * processes. These child processes are in a new PID namespace with different
d811e0
+ * PID configurations (group leader, session leader, ...). If any child
d811e0
+ * terminates with nonzero exit status the test is failed. Otherwise the test is
d811e0
+ * succesful, and the parent process exits with 0.
d811e0
+ */
d811e0
+void pidns_test_init(void);
d811e0
+
d811e0
+#endif
d811e0
\ No newline at end of file
d811e0
Index: strace-5.7/tests/Makefile.in
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests/Makefile.in	2020-09-09 19:46:24.904450714 +0200
d811e0
+++ strace-5.7/tests/Makefile.in	2020-09-09 19:51:23.607628754 +0200
d811e0
@@ -531,7 +531,7 @@
d811e0
 	libtests_a-libmmsg.$(OBJEXT) \
d811e0
 	libtests_a-libsocketcall.$(OBJEXT) \
d811e0
 	libtests_a-lock_file.$(OBJEXT) \
d811e0
-	libtests_a-overflowuid.$(OBJEXT) \
d811e0
+	libtests_a-overflowuid.$(OBJEXT) libtests_a-pidns.$(OBJEXT) \
d811e0
 	libtests_a-pipe_maxfd.$(OBJEXT) \
d811e0
 	libtests_a-print_quoted_string.$(OBJEXT) \
d811e0
 	libtests_a-print_time.$(OBJEXT) \
d811e0
@@ -3899,6 +3899,7 @@
d811e0
 	./$(DEPDIR)/libtests_a-libsocketcall.Po \
d811e0
 	./$(DEPDIR)/libtests_a-lock_file.Po \
d811e0
 	./$(DEPDIR)/libtests_a-overflowuid.Po \
d811e0
+	./$(DEPDIR)/libtests_a-pidns.Po \
d811e0
 	./$(DEPDIR)/libtests_a-pipe_maxfd.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_quoted_string.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_time.Po \
d811e0
@@ -5122,6 +5123,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
@@ -9926,6 +9929,7 @@
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-overflowuid.Po@am__quote@ # am--include-marker
d811e0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pidns.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pipe_maxfd.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_quoted_string.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_time.Po@am__quote@ # am--include-marker
d811e0
@@ -10651,6 +10655,20 @@
d811e0
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-overflowuid.obj `if test -f 'overflowuid.c'; then $(CYGPATH_W) 'overflowuid.c'; else $(CYGPATH_W) '$(srcdir)/overflowuid.c'; fi`
d811e0
 
d811e0
+libtests_a-pidns.o: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.o -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.o' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+
d811e0
+libtests_a-pidns.obj: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.obj -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.obj' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+
d811e0
 libtests_a-pipe_maxfd.o: pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pipe_maxfd.o -MD -MP -MF $(DEPDIR)/libtests_a-pipe_maxfd.Tpo -c -o libtests_a-pipe_maxfd.o `test -f 'pipe_maxfd.c' || echo '$(srcdir)/'`pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pipe_maxfd.Tpo $(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
@@ -11748,6 +11766,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po
d811e0
@@ -12605,6 +12624,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po
d811e0
Index: strace-5.7/tests-m32/Makefile.in
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-m32/Makefile.in	2020-09-09 19:49:34.530563739 +0200
d811e0
+++ strace-5.7/tests-m32/Makefile.in	2020-09-09 19:52:01.333651241 +0200
d811e0
@@ -531,7 +531,7 @@
d811e0
 	libtests_a-libmmsg.$(OBJEXT) \
d811e0
 	libtests_a-libsocketcall.$(OBJEXT) \
d811e0
 	libtests_a-lock_file.$(OBJEXT) \
d811e0
-	libtests_a-overflowuid.$(OBJEXT) \
d811e0
+	libtests_a-overflowuid.$(OBJEXT) libtests_a-pidns.$(OBJEXT) \
d811e0
 	libtests_a-pipe_maxfd.$(OBJEXT) \
d811e0
 	libtests_a-print_quoted_string.$(OBJEXT) \
d811e0
 	libtests_a-print_time.$(OBJEXT) \
d811e0
@@ -3899,6 +3899,7 @@
d811e0
 	./$(DEPDIR)/libtests_a-libsocketcall.Po \
d811e0
 	./$(DEPDIR)/libtests_a-lock_file.Po \
d811e0
 	./$(DEPDIR)/libtests_a-overflowuid.Po \
d811e0
+	./$(DEPDIR)/libtests_a-pidns.Po \
d811e0
 	./$(DEPDIR)/libtests_a-pipe_maxfd.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_quoted_string.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_time.Po \
d811e0
@@ -5122,6 +5123,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
@@ -9926,6 +9929,7 @@
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-overflowuid.Po@am__quote@ # am--include-marker
d811e0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pidns.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pipe_maxfd.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_quoted_string.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_time.Po@am__quote@ # am--include-marker
d811e0
@@ -10651,6 +10655,20 @@
d811e0
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-overflowuid.obj `if test -f 'overflowuid.c'; then $(CYGPATH_W) 'overflowuid.c'; else $(CYGPATH_W) '$(srcdir)/overflowuid.c'; fi`
d811e0
 
d811e0
+libtests_a-pidns.o: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.o -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.o' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+
d811e0
+libtests_a-pidns.obj: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.obj -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.obj' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+
d811e0
 libtests_a-pipe_maxfd.o: pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pipe_maxfd.o -MD -MP -MF $(DEPDIR)/libtests_a-pipe_maxfd.Tpo -c -o libtests_a-pipe_maxfd.o `test -f 'pipe_maxfd.c' || echo '$(srcdir)/'`pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pipe_maxfd.Tpo $(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
@@ -11748,6 +11766,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po
d811e0
@@ -12605,6 +12624,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po
d811e0
Index: strace-5.7/tests-mx32/Makefile.in
d811e0
===================================================================
d811e0
--- strace-5.7.orig/tests-mx32/Makefile.in	2020-09-09 19:49:39.557566736 +0200
d811e0
+++ strace-5.7/tests-mx32/Makefile.in	2020-09-09 19:52:26.062665980 +0200
d811e0
@@ -531,7 +531,7 @@
d811e0
 	libtests_a-libmmsg.$(OBJEXT) \
d811e0
 	libtests_a-libsocketcall.$(OBJEXT) \
d811e0
 	libtests_a-lock_file.$(OBJEXT) \
d811e0
-	libtests_a-overflowuid.$(OBJEXT) \
d811e0
+	libtests_a-overflowuid.$(OBJEXT) libtests_a-pidns.$(OBJEXT) \
d811e0
 	libtests_a-pipe_maxfd.$(OBJEXT) \
d811e0
 	libtests_a-print_quoted_string.$(OBJEXT) \
d811e0
 	libtests_a-print_time.$(OBJEXT) \
d811e0
@@ -3899,6 +3899,7 @@
d811e0
 	./$(DEPDIR)/libtests_a-libsocketcall.Po \
d811e0
 	./$(DEPDIR)/libtests_a-lock_file.Po \
d811e0
 	./$(DEPDIR)/libtests_a-overflowuid.Po \
d811e0
+	./$(DEPDIR)/libtests_a-pidns.Po \
d811e0
 	./$(DEPDIR)/libtests_a-pipe_maxfd.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_quoted_string.Po \
d811e0
 	./$(DEPDIR)/libtests_a-print_time.Po \
d811e0
@@ -5122,6 +5123,8 @@
d811e0
 	libsocketcall.c \
d811e0
 	lock_file.c \
d811e0
 	overflowuid.c \
d811e0
+	pidns.c \
d811e0
+	pidns.h \
d811e0
 	pipe_maxfd.c \
d811e0
 	print_quoted_string.c \
d811e0
 	print_time.c \
d811e0
@@ -9926,6 +9929,7 @@
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-overflowuid.Po@am__quote@ # am--include-marker
d811e0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pidns.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-pipe_maxfd.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_quoted_string.Po@am__quote@ # am--include-marker
d811e0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-print_time.Po@am__quote@ # am--include-marker
d811e0
@@ -10651,6 +10655,20 @@
d811e0
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-overflowuid.obj `if test -f 'overflowuid.c'; then $(CYGPATH_W) 'overflowuid.c'; else $(CYGPATH_W) '$(srcdir)/overflowuid.c'; fi`
d811e0
 
d811e0
+libtests_a-pidns.o: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.o -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.o' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.o `test -f 'pidns.c' || echo '$(srcdir)/'`pidns.c
d811e0
+
d811e0
+libtests_a-pidns.obj: pidns.c
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pidns.obj -MD -MP -MF $(DEPDIR)/libtests_a-pidns.Tpo -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pidns.Tpo $(DEPDIR)/libtests_a-pidns.Po
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pidns.c' object='libtests_a-pidns.obj' libtool=no @AMDEPBACKSLASH@
d811e0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
d811e0
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-pidns.obj `if test -f 'pidns.c'; then $(CYGPATH_W) 'pidns.c'; else $(CYGPATH_W) '$(srcdir)/pidns.c'; fi`
d811e0
+
d811e0
 libtests_a-pipe_maxfd.o: pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-pipe_maxfd.o -MD -MP -MF $(DEPDIR)/libtests_a-pipe_maxfd.Tpo -c -o libtests_a-pipe_maxfd.o `test -f 'pipe_maxfd.c' || echo '$(srcdir)/'`pipe_maxfd.c
d811e0
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-pipe_maxfd.Tpo $(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
@@ -11748,6 +11766,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po
d811e0
@@ -12605,6 +12624,7 @@
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-overflowuid.Po
d811e0
+	-rm -f ./$(DEPDIR)/libtests_a-pidns.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-pipe_maxfd.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_quoted_string.Po
d811e0
 	-rm -f ./$(DEPDIR)/libtests_a-print_time.Po