From 7d5ac8338d35d3faaf5f83f57dd4ac2fa5801ed4 Mon Sep 17 00:00:00 2001 From: Dmitry Safonov Date: Fri, 16 Jun 2017 20:10:18 +0300 Subject: [PATCH] zdtm: Add infop to waitid() in pidns0{2,3} 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 Signed-off-by: Dmitry Safonov Reviewed-by: Kirill Tkhai Signed-off-by: Andrei Vagin --- 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 80262f090..527b65c16 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 9d7d7635e..28802870c 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;