[igt-dev] [PATCH i-g-t v2] igt/gem_userptr: Check read-only mappings

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 13 15:03:29 UTC 2018


Quoting Tvrtko Ursulin (2018-07-13 15:51:50)
> 
> On 13/07/2018 11:59, Chris Wilson wrote:
> > +     /* Now enforce read-only henceforth */
> > +     igt_assert(mprotect(space, total, PROT_READ) == 0);
> 
> If rhandle was still alive, would this trigger the mmu notifier 
> invalidation? Something to check maybe, if there is such hook.

But from rhandle's point of view, not much happens. It's just a regular
invalidation and recovery, I think covered by the mmap-invalidate tests.

> > +
> > +     /* Check that we disallow removing the readonly protection */
> 
> What does it mean that we are disallowing it? Is it more that we are 
> oblivious to it (form the userptr bo point of view)?

No, that mprotect(PROT_WRITE) reports an error if you try to change the
protection from PROT_READ, so you are not allowed to create
mmap_gtt(PROT_WRITE) into a read-only userptr, nor are you allowed to
get around that restriction by changing the CPU PTE protection later.
-Chris


More information about the igt-dev mailing list