Commit b99fbf66 authored by Pavel Emelyanov's avatar Pavel Emelyanov

check/zdtm: Check userns feature in criu

This is the continuation -- check relevant userns features in criu check.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 0749ef23
......@@ -748,6 +748,26 @@ static int check_tun(void)
return check_tun_cr(-1);
}
static int check_userns(void)
{
int ret;
unsigned long size = 0;
ret = access("/proc/self/ns/user", F_OK);
if (ret) {
pr_perror("No userns proc file");
return -1;
}
ret = sys_prctl(PR_SET_MM, PR_SET_MM_MAP_SIZE, (unsigned long)&size, 0, 0);
if (ret) {
pr_perror("No new prctl API");
return -1;
}
return 0;
}
int check_add_feature(char *feat)
{
if (!strcmp(feat, "mnt_id"))
......@@ -758,6 +778,8 @@ int check_add_feature(char *feat)
chk_feature = check_timerfd;
else if (!strcmp(feat, "tun"))
chk_feature = check_tun;
else if (!strcmp(feat, "userns"))
chk_feature = check_userns;
else {
pr_err("Unknown feature %s\n", feat);
return -1;
......
......@@ -284,15 +284,9 @@ ns/static/mntns_shared_bind02
ns/static/mntns_root_bind
"
can_cr_userns() {
[ ! -f /proc/self/ns/user ] && return 1
$CRIU check | fgrep -q 'PR_SET_MM_MAP is not supported' && return 1
return 0 # this means TRUE in bash :\
}
# Add tests which can be executed in an user namespace
if can_cr_userns ; then
$CRIU check --feature "userns"
if [ $? -eq 0 ]; then
blist=`mktemp /tmp/zdtm.black.XXXXXX`
echo "$BLACKLIST_FOR_USERNS" | sort > $blist
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment