mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
zdtm: check a ghost file in a read-only directory
=[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@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
330b0d1656
commit
9d03d77f20
1
test/zdtm/.gitignore
vendored
1
test/zdtm/.gitignore
vendored
@@ -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
|
||||
|
@@ -219,6 +219,7 @@ TST_DIR = \
|
||||
cgroup02 \
|
||||
cgroup03 \
|
||||
cgroup_stray \
|
||||
unlink_fstat04 \
|
||||
mntns_open \
|
||||
mntns_link_remap \
|
||||
mntns_link_ghost \
|
||||
@@ -376,6 +377,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
|
||||
|
@@ -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;
|
||||
|
1
test/zdtm/static/unlink_fstat04.c
Symbolic link
1
test/zdtm/static/unlink_fstat04.c
Symbolic link
@@ -0,0 +1 @@
|
||||
unlink_fstat00.c
|
1
test/zdtm/static/unlink_fstat04.desc
Normal file
1
test/zdtm/static/unlink_fstat04.desc
Normal file
@@ -0,0 +1 @@
|
||||
{ "flags" : "suid" }
|
Reference in New Issue
Block a user