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

Tycho Andersen tycho.andersen at canonical.com
Thu Jun 25 07:56:03 PDT 2015


On Thu, Jun 25, 2015 at 02:15:26PM +0300, Pavel Emelyanov wrote:
> > +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?

Whoops, yes :)

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


More information about the CRIU mailing list