[CRIU] [PATCH 2/2] add a `criu check` test for PTRACE_O_SUSPEND_SECCOMP

Pavel Emelyanov xemul at parallels.com
Thu Jun 25 04:15:26 PDT 2015


> +static int check_ptrace_suspend_seccomp(void)
> +{
> +	pid_t pid;
> +	int ret = 0;
> +
> +	if (opts.check_ms_kernel) {
> +		pr_warn("Skipping PTRACE_O_SUSPEND_SECCOMP check\n");
> +		return 0;
> +	}
> +
> +	pid = fork_and_ptrace_attach();
> +	if (pid < 0)
> +		return -1;
> +
> +	if (ptrace(PTRACE_SETOPTIONS, pid, NULL, PTRACE_O_SUSPEND_SECCOMP) < 0) {
> +		if (errno == EINVAL) {
> +			pr_err("Kernel doesn't support PTRACE_O_SUSPEND_SECCOMP\n");
> +		} else {
> +			pr_perror("couldn't suspend seccomp");
> +		}

Should the ret be set to -1 here?

> +	}
> +
>  	kill(pid, SIGKILL);
>  	return ret;
>  }



More information about the CRIU mailing list