[CRIU] [PATCH] zdtm: Add infop to waitid() in pidns0{2,3}

Dmitry Safonov dsafonov at virtuozzo.com
Fri Jun 16 20:10:18 MSK 2017


As said in man page:
> The application shall ensure that the infop argument
> points to a siginfo_t structure.

While x86_64 ignores NULL, ia32 syscall returns error:
Test output: ================================
20:52:47.176:     4: FAIL: pidns02.c:158: Can't wait (errno = 14 (Bad address))
20:52:47.177:     4: FAIL: pidns02.c:183: Test failed (errno = 14 (Bad address))
20:52:47.177:     3: ERR: test.c:228: Test exited unexpectedly with code 255
 <<< ================================

Test output: ================================
20:53:27.835:     1: FAIL: pidns03.c:119: Can't wait (errno = 14 (Bad address))
20:53:28.207:     4: FAIL: pidns03.c:201: Can't wait or bad status: errno=0, status=32512 (errno = 0 (Success))
 <<< ================================

Cc: Kirill Tkhai <ktkhai at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 test/zdtm/static/pidns02.c | 3 ++-
 test/zdtm/static/pidns03.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/static/pidns02.c b/test/zdtm/static/pidns02.c
index 80262f0909cb..527b65c16549 100644
--- a/test/zdtm/static/pidns02.c
+++ b/test/zdtm/static/pidns02.c
@@ -103,6 +103,7 @@ int main(int argc, char **argv)
 	int i, status, ret = -1;
 	pid_t pid[] = {-1, -1};
 	char *ns_pid, *tmp;
+	siginfo_t infop;
 
 	test_init(argc, argv);
 	futex = mmap(NULL, sizeof(*futex), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
@@ -153,7 +154,7 @@ int main(int argc, char **argv)
 		fail("Can't kill");
 		goto out;
 	}
-	ret = waitid(P_PID, pid[1], NULL, WEXITED|WNOWAIT);
+	ret = waitid(P_PID, pid[1], &infop, WEXITED|WNOWAIT);
 	if (ret) {
 		fail("Can't wait");
 		goto out;
diff --git a/test/zdtm/static/pidns03.c b/test/zdtm/static/pidns03.c
index 9d7d7635ef5d..28802870c87a 100644
--- a/test/zdtm/static/pidns03.c
+++ b/test/zdtm/static/pidns03.c
@@ -93,6 +93,7 @@ static int child_fn(void)
 {
 	long thread_retval;
 	pthread_t thread;
+	siginfo_t infop;
 	pid_t pid;
 	int ret;
 
@@ -114,7 +115,7 @@ static int child_fn(void)
 	} else if (!pid)
 		exit(0);
 
-	ret = waitid(P_PID, pid, NULL, WEXITED|WNOWAIT);
+	ret = waitid(P_PID, pid, &infop, WEXITED|WNOWAIT);
 	if (ret) {
 		fail("Can't wait");
 		goto err;
-- 
2.12.2



More information about the CRIU mailing list