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

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Jul 13 15:14:35 UTC 2018


On 13/07/2018 16:03, Chris Wilson wrote:
> 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.

Yeah looks like that test_invalidate_close_race implies mmu notifier is 
indeed invoked on pgprot changes. So it's good.

>>> +
>>> +     /* 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.

Ah so disallowed by the core kernel? I missed that is how things work.

Regards,

Tvrtko


More information about the Intel-gfx mailing list