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

Pavel Emelyanov xemul at parallels.com
Tue Jun 2 05:41:54 PDT 2015


> +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.



More information about the CRIU mailing list