[CRIU] [PATCH] [v2] zdtm: check a ghost file in a read-only directory
Andrey Vagin
avagin at openvz.org
Thu Apr 28 15:09:22 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
=[log]=> dump/zdtm/static/unlink_fstat00/39/1/restore.log
------------------------ grep Error ------------------------
(00.097701) 4: Error (files-reg.c:1231): Can't link zdtm/static/unlink_fstat00.test/test\file'
(00.097707) 4: Error (files-reg.c:1431): Can't link zdtm/static/unlink_fstat00.test/test\file'
(00.097952) 1: Error (cr-restore.c:1404): 4 exited, status=1
(00.108085) Error (cr-restore.c:1407): 64 killed by signal 9: Killed
(00.114341) Error (cr-restore.c:2246): Restoring FAILED.
------------------------ ERROR OVER ------------------------
v2: add a new test instead of changing the existing one.
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/.gitignore | 1 +
test/zdtm/static/Makefile | 2 ++
test/zdtm/static/unlink_fstat00.c | 21 +++++++++++++++++++++
test/zdtm/static/unlink_fstat04.c | 1 +
test/zdtm/static/unlink_fstat04.desc | 1 +
5 files changed, 26 insertions(+)
create mode 120000 test/zdtm/static/unlink_fstat04.c
create mode 100644 test/zdtm/static/unlink_fstat04.desc
diff --git a/test/zdtm/.gitignore b/test/zdtm/.gitignore
index 408d5c0..7a19868 100644
--- a/test/zdtm/.gitignore
+++ b/test/zdtm/.gitignore
@@ -185,6 +185,7 @@
/static/unlink_fstat01+
/static/unlink_fstat02
/static/unlink_fstat03
+/static/unlink_fstat04
/static/unlink_largefile
/static/unlink_mmap00
/static/unlink_mmap01
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index ac244e4..e668fb4 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -219,6 +219,7 @@ TST_DIR = \
cgroup02 \
cgroup03 \
cgroup_stray \
+ unlink_fstat04 \
mntns_open \
mntns_link_remap \
mntns_link_ghost \
@@ -377,6 +378,7 @@ maps02: get_smaps_bits.o
mlock_setuid: get_smaps_bits.o
inotify01: override CFLAGS += -DINOTIFY01
unlink_fstat01+: override CFLAGS += -DUNLINK_OVER
+unlink_fstat04: override CFLAGS += -DUNLINK_FSTAT04
sk-freebind-false: override CFLAGS += -DZDTM_FREEBIND_FALSE
stopped01: override CFLAGS += -DZDTM_STOPPED_KILL
stopped02: override CFLAGS += -DZDTM_STOPPED_TKILL
diff --git a/test/zdtm/static/unlink_fstat00.c b/test/zdtm/static/unlink_fstat00.c
index 4965dbc..f741099 100644
--- a/test/zdtm/static/unlink_fstat00.c
+++ b/test/zdtm/static/unlink_fstat00.c
@@ -5,13 +5,19 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
+#include <linux/limits.h>
#include "zdtmtst.h"
const char *test_doc = "Open, unlink, change size, seek, migrate, check size";
+#ifdef UNLINK_FSTAT04
+char *dirname;
+TEST_OPTION(dirname, string, "directory name", 1);
+#else
char *filename;
TEST_OPTION(filename, string, "file name", 1);
+#endif
int main(int argc, char ** argv)
{
@@ -23,15 +29,30 @@ int main(int argc, char ** argv)
uint8_t buf[fsize];
struct stat fst;
uint32_t crc;
+#ifdef UNLINK_FSTAT04
+ char filename[PATH_MAX];
+#endif
test_init(argc, argv);
+#ifdef UNLINK_FSTAT04
+ snprintf(filename, sizeof(filename), "%s/test\\file'\n\"un%%linkfstat00", dirname);
+
+ mkdir(dirname, 0700);
+#endif
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
pr_perror("can't open %s", filename);
exit(1);
}
+#ifdef UNLINK_FSTAT04
+ if (chmod(dirname, 0500)) {
+ pr_perror("chmod");
+ exit(1);
+ }
+#endif
+
if (fstat(fd, &fst) < 0) {
pr_perror("can't get file info %s before", filename);
goto failed;
diff --git a/test/zdtm/static/unlink_fstat04.c b/test/zdtm/static/unlink_fstat04.c
new file mode 120000
index 0000000..f51b3c6
--- /dev/null
+++ b/test/zdtm/static/unlink_fstat04.c
@@ -0,0 +1 @@
+unlink_fstat00.c
\ No newline at end of file
diff --git a/test/zdtm/static/unlink_fstat04.desc b/test/zdtm/static/unlink_fstat04.desc
new file mode 100644
index 0000000..48e131a
--- /dev/null
+++ b/test/zdtm/static/unlink_fstat04.desc
@@ -0,0 +1 @@
+{ "flags" : "suid" }
--
2.5.5
More information about the CRIU
mailing list