mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
zdtm: check read-only tmpfs in userns
travis-ci: success for Fix a few issues to dump/restore Docker containers with userns Signed-off-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
771e33214c
commit
5cb1ce94fe
@ -221,6 +221,7 @@ TST_DIR = \
|
||||
tempfs_overmounted \
|
||||
tempfs_overmounted01 \
|
||||
tempfs_ro \
|
||||
tempfs_ro02 \
|
||||
tempfs_subns \
|
||||
mnt_ro_bind \
|
||||
mount_paths \
|
||||
|
50
test/zdtm/static/tempfs_ro02.c
Normal file
50
test/zdtm/static/tempfs_ro02.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
const char *test_doc = "Check read-only tmpfs mount";
|
||||
const char *test_author = "Andrew Vagin <avagin@openvz.org>";
|
||||
|
||||
char *dirname;
|
||||
TEST_OPTION(dirname, string, "directory name", 1);
|
||||
|
||||
#define TEST_WORD "testtest"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd, ret = 1;
|
||||
char buf[1024], fname[PATH_MAX];
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
mkdir(dirname, 0700);
|
||||
if (mount("none", dirname, "tmpfs", MS_RDONLY, "") < 0) {
|
||||
fail("Can't mount tmpfs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(fname, sizeof(buf), "%s/test.file", dirname);
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
|
||||
fd = open(fname, O_RDWR | O_CREAT, 0777);
|
||||
if (fd >= 0 || errno != EROFS) {
|
||||
pr_perror("open failed -> %d", fd);
|
||||
goto err;
|
||||
}
|
||||
|
||||
pass();
|
||||
ret = 0;
|
||||
err:
|
||||
umount2(dirname, MNT_DETACH);
|
||||
rmdir(dirname);
|
||||
return ret;
|
||||
}
|
1
test/zdtm/static/tempfs_ro02.desc
Normal file
1
test/zdtm/static/tempfs_ro02.desc
Normal file
@ -0,0 +1 @@
|
||||
{'flavor': 'ns uns', 'flags': 'suid'}
|
Loading…
x
Reference in New Issue
Block a user