[CRIU] [PATCH 2/3] add a test for SECCOMP_MODE_STRICT

Tycho Andersen tycho.andersen at canonical.com
Tue Jun 2 06:38:34 PDT 2015


On Tue, Jun 02, 2015 at 03:41:54PM +0300, Pavel Emelyanov wrote:
> 
> > +int main(int argc, char ** argv)
> > +{
> > +	pid_t pid;
> > +	FILE *f;
> > +	char buf[PATH_MAX];
> > +	bool found = false;
> > +	int ret = 1;
> > +
> > +	test_init(argc, argv);
> > +
> > +	pid = fork();
> > +	if (pid < 0) {
> > +		err("fork");
> > +		return -1;
> > +	}
> > +
> > +	if (pid == 0) {
> > +		if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) < 0) {
> > +			err("prctl failed");
> > +			return -1;
> > +		}
> > +
> > +		while(1)
> > +			/* can't sleep() here, seccomp kills us */;
> > +	}
> > +
> > +	test_daemon();
> > +	test_waitsig();
> 
> The above is race -- test_daemon() can be called before child turns
> seccomp on and CRIU will just dump "unseccomped" task.

Whoops, yep, you're right of course. I'll fix and resend.

Tycho


More information about the CRIU mailing list