[CRIU] [BUG] Opened /proc/pid directory of dead tasks fails restore

Pavel Emelyanov xemul at parallels.com
Thu Dec 24 05:58:05 PST 2015


Hi, Tycho! Merry Christmas and happy New Year :) I have a present for you ;)

If slightly modifying the remap_dead_pid test to make it open not
/proc/pid/some file, but the /proc/pid/ directory itself, the restore
fails with

(00.002065)     77: Error (files-reg.c:1308): Can't open file proc/78 (deleted) on restore: No such file or directory
(00.002068)     77: Error (files-reg.c:1251): Can't open file proc/78 (deleted): No such file or directory

In the images dir the remap image is absent, that makes me think that
the logic in check_path_remap() misses the /proc/pid directory for
exited tasks.

No hurry with this, would you take a look at the issue once time permits?

Thanks!

---
 test/zdtm/live/static/Makefile                | 2 ++
 test/zdtm/live/static/remap_dead_pid.c        | 7 ++++++-
 test/zdtm/live/static/remap_dead_pid_dir.c    | 1 +
 test/zdtm/live/static/remap_dead_pid_dir.desc | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)
 create mode 120000 test/zdtm/live/static/remap_dead_pid_dir.c
 create mode 100644 test/zdtm/live/static/remap_dead_pid_dir.desc

diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index 42eea67..6add552 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -132,6 +132,7 @@ TST_NOFILE	=				\
 		dumpable01			\
 		dumpable02			\
 		remap_dead_pid			\
+		remap_dead_pid_dir		\
 		aio00				\
 		fd				\
 		apparmor				\
@@ -368,6 +369,7 @@ sk-freebind-false:	override CFLAGS += -DZDTM_FREEBIND_FALSE
 stopped01:	override CFLAGS += -DZDTM_STOPPED_KILL
 stopped02:	override CFLAGS += -DZDTM_STOPPED_TKILL
 stopped12:	override CFLAGS += -DZDTM_STOPPED_KILL -DZDTM_STOPPED_TKILL
+remap_dead_pid_dir:	override CFLAGS += -DZDTM_PROC_DIR
 
 $(LIB):	force
 	$(Q) $(MAKE) -C $(LIBDIR)
diff --git a/test/zdtm/live/static/remap_dead_pid.c b/test/zdtm/live/static/remap_dead_pid.c
index c16832d..08efd55 100644
--- a/test/zdtm/live/static/remap_dead_pid.c
+++ b/test/zdtm/live/static/remap_dead_pid.c
@@ -40,9 +40,14 @@ int main(int argc, char **argv)
 		char path[PATH_MAX];
 		pid_t result;
 
+#ifdef ZDTM_PROC_DIR
+		sprintf(path, "/proc/%d", pid);
+		fd = open(path, O_RDONLY | O_DIRECTORY);
+#else
 		sprintf(path, "/proc/%d/mountinfo", pid);
-
 		fd = open(path, O_RDONLY);
+#endif
+
 
 		/* no matter what, we should kill the child */
 		kill(pid, SIGKILL);
diff --git a/test/zdtm/live/static/remap_dead_pid_dir.c b/test/zdtm/live/static/remap_dead_pid_dir.c
new file mode 120000
index 0000000..3739fc7
--- /dev/null
+++ b/test/zdtm/live/static/remap_dead_pid_dir.c
@@ -0,0 +1 @@
+remap_dead_pid.c
\ No newline at end of file
diff --git a/test/zdtm/live/static/remap_dead_pid_dir.desc b/test/zdtm/live/static/remap_dead_pid_dir.desc
new file mode 100644
index 0000000..63df42a
--- /dev/null
+++ b/test/zdtm/live/static/remap_dead_pid_dir.desc
@@ -0,0 +1 @@
+{'flavor': 'h'}
-- 
1.9.3



More information about the CRIU mailing list