[CRIU] [PATCH 1/7] cgroup: add a check for cgroup namespaces
Pavel Emelyanov
xemul at virtuozzo.com
Thu Feb 18 10:30:17 PST 2016
On 02/18/2016 07:08 PM, Tycho Andersen wrote:
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
> criu/cr-check.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/criu/cr-check.c b/criu/cr-check.c
> index 2bb0d9a..854a8a4 100644
> --- a/criu/cr-check.c
> +++ b/criu/cr-check.c
> @@ -820,6 +820,16 @@ static int check_clone_parent_vs_pid()
> return 0;
> }
>
> +static int check_cgroupns(void)
> +{
> + if (opts.check_ms_kernel) {
> + pr_warn("Skipping cgroup namespaces check\n");
> + return 0;
> + }
> +
> + return access("/proc/self/ns/cgroup", F_OK);
Here should come a message that says what's wrong if the access() fails.
> +}
> +
> static int (*chk_feature)(void);
>
> int cr_check(void)
> @@ -876,6 +886,7 @@ int cr_check(void)
> ret |= check_aio_remap();
> ret |= check_fdinfo_lock();
> ret |= check_clone_parent_vs_pid();
> + ret |= check_cgroupns();
>
> out:
> if (!ret)
> @@ -949,6 +960,8 @@ int check_add_feature(char *feat)
> chk_feature = check_ptrace_dump_seccomp_filters;
> else if (!strcmp(feat, "loginuid"))
> chk_feature = check_loginuid;
> + else if (!strcmp(feat, "cgroupns"))
> + chk_feature = check_cgroupns;
> else {
> pr_err("Unknown feature %s\n", feat);
> return -1;
>
More information about the CRIU
mailing list