[igt-dev] [PATCH i-g-t] i915/gem_userptr_blits: Check for allowed GTT mmaps

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 2 08:47:51 UTC 2019


Quoting Tvrtko Ursulin (2019-10-02 09:42:01)
> 
> On 01/10/2019 18:49, Chris Wilson wrote:
> > @@ -1225,7 +1247,7 @@ static void test_readonly_mmap(int i915)
> >       original = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
> >   
> >       ptr = __gem_mmap__gtt(i915, handle, sz, PROT_WRITE);
> > -     igt_assert(ptr == NULL);
> > +     igt_require(ptr != NULL);
> 
> This should be able to stay unchanged, no? Whether read-only or mmap_gtt 
> is disallowed it must always be NULL here. Non-NULL should be test fail.

The test is also checking that readonly is honoured through the GTT mmap
interface, i.e. that you cannot write into imported memory, thereby
circumventing userptr(mmap("/etc/passwd", PROT_READ)).

I stuck the require in the wrong spot...
-Chris


More information about the igt-dev mailing list