Commit 7e815625 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

cr-check: add userns/loginuid checks to extra features

All kernel options, features that depend on kernel version
should be checked with `criu check`.

Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 65214e44
......@@ -1025,6 +1025,39 @@ static int check_tcp_window(void)
return 0;
}
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 = prctl(PR_SET_MM, PR_SET_MM_MAP_SIZE, (unsigned long)&size, 0, 0);
if (ret < 0) {
pr_perror("prctl: PR_SET_MM_MAP_SIZE is not supported");
return -1;
}
return 0;
}
static int check_loginuid(void)
{
if (kerndat_loginuid(false) < 0)
return -1;
if (!kdat.has_loginuid) {
pr_warn("Loginuid restore is OFF.\n");
return -1;
}
return 0;
}
static int (*chk_feature)(void);
/*
......@@ -1126,6 +1159,8 @@ int cr_check(void)
ret |= check_cgroupns();
ret |= check_tcp_window();
ret |= check_tcp_halt_closed();
ret |= check_userns();
ret |= check_loginuid();
}
/*
......@@ -1154,39 +1189,6 @@ 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 = prctl(PR_SET_MM, PR_SET_MM_MAP_SIZE, (unsigned long)&size, 0, 0);
if (ret < 0) {
pr_perror("prctl: PR_SET_MM_MAP_SIZE is not supported");
return -1;
}
return 0;
}
static int check_loginuid(void)
{
if (kerndat_loginuid(false) < 0)
return -1;
if (!kdat.has_loginuid) {
pr_warn("Loginuid restore is OFF.\n");
return -1;
}
return 0;
}
struct feature_list {
char *name;
int (*func)();
......
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