lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jan 2018 10:42:41 +0800
From:   Sandy Huang <hjc@...k-chips.com>
To:     Thierry Escande <thierry.escande@...labora.com>,
        Archit Taneja <architt@...eaurora.org>,
        Inki Dae <inki.dae@...sung.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Sean Paul <seanpaul@...omium.org>,
        David Airlie <airlied@...ux.ie>,
        Tomasz Figa <tfiga@...omium.org>
Cc:     Zain Wang <wzz@...k-chips.com>, Lin Huang <hl@...k-chips.com>,
        Douglas Anderson <dianders@...omium.org>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        linux-rockchip@...ts.infradead.org,
        Ørjan Eide <orjan.eide@....com>,
        Haixia Shi <hshi@...omium.org>
Subject: Re: [PATCH v2 03/43] drm/rockchip: Respect page offset for PRIME mmap
 calls



在 2018/1/26 21:16, Thierry Escande 写道:
> From: Ørjan Eide <orjan.eide@....com>
> 
> When mapping external DMA-bufs through the PRIME mmap call, we might be
> given an offset which has to be respected. However for the internal DRM
> GEM mmap path, we have to ignore the fake mmap offset used to identify
> the buffer only. Currently the code always zeroes out vma->vm_pgoff,
> which breaks the former.
> 
> This patch fixes the problem by moving the vm_pgoff assignment to a
> function that is used only for GEM mmap path, so that the PRIME path
> retains the original offset.
> 
> Cc: Daniel Kurtz <djkurtz@...omium.org>
> Signed-off-by: Ørjan Eide <orjan.eide@....com>
> Signed-off-by: Tomasz Figa <tfiga@...omium.org>
> Signed-off-by: Sean Paul <seanpaul@...omium.org>
> Signed-off-by: Thierry Escande <thierry.escande@...labora.com>
> Tested-by: Heiko Stuebner <heiko@...ech.de>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> index 5d52020deca1..074db7a92809 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> @@ -264,7 +264,6 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,
>   	 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
>   	 */
>   	vma->vm_flags &= ~VM_PFNMAP;
> -	vma->vm_pgoff = 0;
>   
>   	if (rk_obj->pages)
>   		ret = rockchip_drm_gem_object_mmap_iommu(obj, vma);
> @@ -299,6 +298,12 @@ int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>   	if (ret)
>   		return ret;
>   
> +	/*
> +	 * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the
> +	 * whole buffer from the start.
> +	 */
> +	vma->vm_pgoff = 0;
> +
>   	obj = vma->vm_private_data;
>   
>   	return rockchip_drm_gem_object_mmap(obj, vma);
> 

Reviewed-by: Sandy huang <hjc@...k-chips.com>

Powered by blists - more mailing lists