[igt-dev] [PATCH i-g-t] lib: Kill residual children at the end of a subtest

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 3 12:00:35 UTC 2020


Quoting Petri Latvala (2020-02-03 11:50:07)
> Care to beef up lib/tests/igt_fork.c to make sure this is all done
> gracefully at subtest level, currently it only checks that the state
> is sane at exit() time?

Something evil like:

pid_t *children = mmap(4096, SHARED);

igt_subtest() {
	igt_fork(child, 4096/sizeof(pid_t)) {
		children[child] = getpid();
	}
	/* leak the children */
}

for (int i = 0; i < 4096/sizeof(pid_t); i++)
	assert(kill(children[i], 0) == -1);
munmap(children, 4096);

Is that legal?
-Chris


More information about the igt-dev mailing list