faul-inject: Check a case when parasite can't initialize a command socket

Submitted by Andrei Vagin on Aug. 5, 2016, 10:42 p.m.

Details

Message ID 1470436927-21833-1-git-send-email-avagin@openvz.org
State Rejected
Series "faul-inject: Check a case when parasite can't initialize a command socket"
Headers show

Commit Message

Andrei Vagin Aug. 5, 2016, 10:42 p.m.
From: Andrew Vagin <avagin@virtuozzo.com>

Give a fake address for a server socket.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
---
 criu/include/fault-injection.h | 1 +
 criu/parasite-syscall.c        | 4 ++++
 test/jenkins/criu-fault.sh     | 2 ++
 3 files changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index 02c8457..e808d19 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -8,6 +8,7 @@  enum faults {
 	FI_RESTORE_ROOT_ONLY,
 	FI_DUMP_PAGES,
 	FI_RESTORE_OPEN_LINK_REMAP,
+	FI_PARASITE_CONNECT,
 	/* not fatal */
 	FI_CHECK_OPEN_HANDLE = 128,
 	FI_NO_MEMFD = 129,
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index b6d283e..75478d9 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -474,6 +474,10 @@  static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
 		}
 	}
 
+	/* Check a case when parasite can't initialize a command socket */
+	if (fault_injected(FI_PARASITE_CONNECT))
+		args->h_addr_len = gen_parasite_saddr(&args->h_addr, getpid() + 1);
+
 	/*
 	 * Set to -1 to prevent any accidental misuse. The
 	 * only valid user of it is accept_tsock().
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index 3ce7a40..83e20b9 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -12,3 +12,5 @@  prep
 
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail
+
+./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail

Comments

Pavel Emelianov Aug. 10, 2016, 1:06 p.m.
Applied