[Intel-gfx] [PATCH] tests/gem_reset_stats: add close-pending-fork
Chris Wilson
chris at chris-wilson.co.uk
Mon Dec 2 16:03:08 CET 2013
On Mon, Dec 02, 2013 at 04:47:46PM +0200, Mika Kuoppala wrote:
> Fork and create another filedesc to wait access to already
> hung GPU and then kill it. This triggers use after free of the
> request->batch_obj.
>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
> +static int __test_open_any(void)
> +{
> + char *name;
> + int ret, fd;
> +
> + ret = asprintf(&name, "/dev/dri/card%d", drm_get_card());
> + if (ret == -1)
> + return -1;
> +
> + fd = open(name, O_RDWR);
> + free(name);
> +
> + return fd;
> +}
> +
> +static void test_close_pending_fork(void)
> +{
> + int pid;
> + int fd, fd2, h;
> +
> + fd = drm_open_any();
> + igt_assert(fd >= 0);
[snip]
> + close(fd);
> +
> + fd = drm_open_any();
This breaks the testsuite since drm_open_any() will now return the
closed fd. Hence your __test_open_any() above.
However this does not justify kernel doing anything other than terminating
your process with extreme prejudice.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list