[igt-dev] [PATCH i-g-t] i915/gem_caching: Fix mmap protection for writes

Ramalingam C ramalingam.c at intel.com
Thu Aug 6 19:10:46 UTC 2020


On 2020-08-06 at 19:31:43 +0100, Chris Wilson wrote:
> As we are about to write into the mmap'ed pointer using memset, we need
> to specify PROT_WRITE [if we only say PROT_READ, then the memset should
> generate a SIGSEGV].
> 
> Fixes: 897d21d14e99 ("i915/gem_caching: Remove libdrm dependency")
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Ramalingam C <ramalingam.c at intel.com>
> Cc: Ramalingam C <ramalingam.c at intel.com>
> Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> ---
>  tests/i915/gem_caching.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_caching.c b/tests/i915/gem_caching.c
> index 1d8989db7..894c4b12e 100644
> --- a/tests/i915/gem_caching.c
> +++ b/tests/i915/gem_caching.c
> @@ -282,7 +282,7 @@ igt_main
>  			val2 = i + 63;
>  			cpu_ptr = gem_mmap__cpu(data.fd, scratch_buf->handle,
>  						0, scratch_buf->surface[0].size,
> -						PROT_READ);
> +						PROT_WRITE);
>  
>  			memset(cpu_ptr + start, val2, len);
>  
> -- 
> 2.28.0
> 


More information about the igt-dev mailing list