mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 21:38:16 +00:00
zdtm: add a test for unsupported children collision
These test is not automatic as after kernel v4.11 behaviour changes, on older kernel we get children collision: 817 188 0:48 / /zdtm/static/unsupported_children_collision.test/share1 rw,relatime shared:942 - tmpfs share rw > 818 817 0:124 / /zdtm/static/unsupported_children_collision.test/share1/child rw,relatime shared:943 - tmpfs child1 rw 819 188 0:48 / /zdtm/static/unsupported_children_collision.test/share2 rw,relatime shared:942 - tmpfs share rw 820 819 0:125 / /zdtm/static/unsupported_children_collision.test/share2/child rw,relatime shared:944 - tmpfs child2 rw > 821 817 0:125 / /zdtm/static/unsupported_children_collision.test/share1/child rw,relatime shared:944 - tmpfs child2 rw Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
parent
f167a1dd34
commit
fc01e18b47
@ -336,6 +336,7 @@ TST_DIR = \
|
||||
del_standalone_un \
|
||||
sk-unix-mntns \
|
||||
sk-unix01 \
|
||||
unsupported_children_collision \
|
||||
|
||||
TST_DIR_FILE = \
|
||||
chroot \
|
||||
|
110
test/zdtm/static/unsupported_children_collision.c
Normal file
110
test/zdtm/static/unsupported_children_collision.c
Normal file
@ -0,0 +1,110 @@
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
const char *test_doc = "Check unsupported children collision for mounts";
|
||||
const char *test_author = "Pavel Tikhomirov <ptikhomirov@virtuozzo.com>";
|
||||
|
||||
char *dirname;
|
||||
TEST_OPTION(dirname, string, "directory name", 1);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char share1[PATH_MAX], share2[PATH_MAX];
|
||||
char child1[PATH_MAX], child2[PATH_MAX];
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
if (mkdir(dirname, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("zdtm_fs", dirname, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, dirname, NULL, MS_PRIVATE, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(share1, sizeof(share1), "%s/share1", dirname);
|
||||
if (mkdir(share1, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("share", share1, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, share1, NULL, MS_SHARED, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(child1, sizeof(child1), "%s/share1/child", dirname);
|
||||
if (mkdir(child1, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("child1", child1, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(share2, sizeof(share2), "%s/share2", dirname);
|
||||
if (mkdir(share2, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(share1, share2, NULL, MS_BIND, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(child2, sizeof(child2), "%s/share2/child", dirname);
|
||||
if (mount("child2", child2, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
if (umount(child2)) {
|
||||
pr_perror("Unable to umount %s", share1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(share2)) {
|
||||
pr_perror("Unable to umount %s", share2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(child1)) {
|
||||
pr_perror("Unable to umount %s", child1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(share1)) {
|
||||
pr_perror("Unable to umount %s", share1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(dirname)) {
|
||||
pr_perror("Unable to umount %s", dirname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pass();
|
||||
|
||||
return 0;
|
||||
}
|
1
test/zdtm/static/unsupported_children_collision.desc
Normal file
1
test/zdtm/static/unsupported_children_collision.desc
Normal file
@ -0,0 +1 @@
|
||||
{'flavor': 'ns uns', 'flags': 'suid noauto crfail'}
|
Loading…
x
Reference in New Issue
Block a user