[igt-dev] [PATCH i-g-t 3/9] tests/kms_lease: invalid corner-cases for create-lease ioctl

Keith Packard keithp at keithp.com
Thu Feb 21 03:08:30 UTC 2019


Daniel Vetter <daniel.vetter at ffwll.ch> writes:

> Found a few things in the kernel that looks suspicious, separate
> patches on their way.

Thanks for adding more tests!

> +	/* empty lease */
> +	mcl.object_ids = 0;
> +	mcl.object_count = 0;
> +	mcl.flags = 0;
> +	igt_assert_eq(create_lease(data->master.fd, &mcl), -EINVAL);

Not sure why this should be invalid? It's not useful, but then neither
are 0x0 windows and look at all the pain not allowing them has caused
over the years...

> +
> +	/* NULL array pointer */
> +	mcl.object_count = 1;
> +	igt_assert_eq(create_lease(data->master.fd, &mcl), -EFAULT);

Should probably explicitly initialize the array pointer here, avoids any
dependency on the previous test.

> +	/* no crtc, non-universal_plane */
> +	drmSetClientCap(data->master.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0);
> +	object_ids[0] = data->master.display.outputs[0].id;
> +	igt_assert_eq(create_lease(data->master.fd, &mcl), -EINVAL);

Similarly, initialize the object count and pointers explicitly.

> +	/* no subleasing */
> +	mcl.object_count = 3;
> +	mcl.flags = 0;
> +	igt_assert_eq(create_lease(data->master.fd, &mcl), 0);
> +	tmp_fd = mcl.fd;
> +	igt_assert_eq(create_lease(tmp_fd, &mcl), -EINVAL);
> +	close(tmp_fd);

Just reminds me that we should probably enable sub-leasing -- useful in
a multi-head environment where you also want to run leased applications
under one of the heads.

All of these tests look OK to me; as usual, the precise errno values are
subject to interpretation, but it looks like you've made reasonable
choices here making me wonder how reasonable the kernel is :-)

Reviewed-by: Keith Packard <keithp at keithp.com>

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20190220/188c9b35/attachment.sig>


More information about the igt-dev mailing list