Quoting Tvrtko Ursulin (2018-09-18 11:59:25) > From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > Move a really small test that invalid context is rejected under the > gem_ctx_exec umbrella. > > v2: > * And actually fix the test so it does what it claims. And add more > variety in the invalid context id's it tests with. (Chris Wilson) > > v3: > * Rename the test as basic. > * Limit to 32-bit. (Chris Wilson) > * Add previously valid but closed context id to the test. (Chris Wilson) > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > --- > diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c > index 1f8ed64d4bd3..1c6c18eddc20 100644 > --- a/tests/gem_ctx_exec.c > +++ b/tests/gem_ctx_exec.c > @@ -30,6 +30,7 @@ > */ > > #include "igt.h" > +#include <limits.h> > #include <unistd.h> > #include <stdlib.h> > #include <stdint.h> > @@ -142,6 +143,34 @@ static void big_exec(int fd, uint32_t handle, int ring) > gem_sync(fd, handle); > } > > +static void invalid_context(int fd, unsigned ring, uint32_t handle) > +{ > + struct drm_i915_gem_exec_object2 obj = { > + .handle = handle, > + }; > + struct drm_i915_gem_execbuffer2 execbuf = { > + .buffers_ptr = to_user_pointer(&obj), > + .buffer_count = 1, > + .flags = ring, > + }; > + uint32_t invalid[] = { 0, 1, INT_MAX, UINT_MAX }; I think I would also do i915_execbuffer2_set_context_id(execbuf, 0); igt_assert_eq(__gem_execbuf(fd, &execbuf), 0); for (int bit = 0; bit < 31; bit++) { i915_execbuffer2_set_context_id(execbuf, 1ul << bit); igt_assert_eq(__gem_execbuf(fd, &execbuf), -ENOENT); } as that would catch any aliasing <32bits with pot mask. (I leave detection of N % M to fuzzers!) Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx