[igt-dev] [RFC 1/4] tests/i915/gem_mmap_gtt: Add invalid parameters test

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 12 22:04:08 UTC 2019


Quoting Antonio Argenziano (2019-03-12 21:57:35)
> Add a test for an invalid handle being passed to the IOCTL.
> 
> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> ---
>  tests/i915/gem_mmap_gtt.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
> index f6fbbe19..58f7403c 100644
> --- a/tests/i915/gem_mmap_gtt.c
> +++ b/tests/i915/gem_mmap_gtt.c
> @@ -831,6 +831,18 @@ igt_main
>         igt_fixture
>                 fd = drm_open_driver(DRIVER_INTEL);
>  
> +       igt_subtest("bad-object") {
> +               struct drm_i915_gem_mmap arg;
> +               int ret;
> +
> +               memset(&arg, 0, sizeof(arg));
> +               arg.handle = 0x10101010;

For bad handles, also try creating a valid handle and checking
for (i = 16; i < BITS_PER_TYPE(arg.handle); i++)
	arg.handle = real_handle | BIT(i);

Especially with (1<<31) set as historically the idr was only a 31-bit
cyclic allocator, so might be susceptible to wraparound.
-Chris


More information about the igt-dev mailing list