Re: [PATCH i-g-t] igt/gem_exec_fence: Add subtest for invalid flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Tvrtko Ursulin (2017-11-03 11:57:54)
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> We need to check that the kernel rejects attempts to pass in
> unknown flags.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  tests/gem_exec_fence.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
> index 2a6da8b074a6..6ee944ffadda 100644
> --- a/tests/gem_exec_fence.c
> +++ b/tests/gem_exec_fence.c
> @@ -1017,6 +1017,34 @@ static void test_syncobj_invalid_wait(int fd)
>         syncobj_destroy(fd, fence.handle);
>  }
>  
> +static void test_syncobj_invalid_flags(int fd)
> +{
> +       const uint32_t bbe = MI_BATCH_BUFFER_END;
> +       struct drm_i915_gem_exec_object2 obj;
> +       struct drm_i915_gem_execbuffer2 execbuf;
> +       struct local_gem_exec_fence fence = {
> +               .handle = syncobj_create(fd),
> +       };
> +
> +       memset(&execbuf, 0, sizeof(execbuf));
> +       execbuf.buffers_ptr = to_user_pointer(&obj);
> +       execbuf.buffer_count = 1;
> +       execbuf.flags = LOCAL_EXEC_FENCE_ARRAY;
> +       execbuf.cliprects_ptr = to_user_pointer(&fence);
> +       execbuf.num_cliprects = 1;
> +
> +       memset(&obj, 0, sizeof(obj));
> +       obj.handle = gem_create(fd, 4096);
> +       gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
> +
> +       /* set all flags to hit an invalid one */
> +       fence.flags = ~0;
> +       igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINVAL);
> +
> +       gem_close(fd, obj.handle);
> +       syncobj_destroy(fd, fence.handle);

Ok. All suggestions I have here end up being kcov-afl.

This applies the rule that the execbuf is correct for all but the single
invalid field,
Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux