All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Archit Taneja <archit@ti.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH 6/7] drm/rcar: gem: dumb: pitch is an output
Date: Wed, 05 Nov 2014 20:47:07 +0200	[thread overview]
Message-ID: <1617531.b7zcoqrk6C@avalon> (raw)
In-Reply-To: <1415193919-1687-7-git-send-email-thierry.reding@gmail.com>

Hi Thierry,

Thank you for the patch.

On Wednesday 05 November 2014 14:25:18 Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB
> IOCTL, only the width, height, bpp and flags fields are inputs. The
> caller is not guaranteed to zero out or set handle, pitch and size.
> Drivers must not treat these values as possible inputs, otherwise they
> may use uninitialized memory during the computation of the framebuffer
> size.
> 
> The R-Car DU driver treats the pitch passed in from userspace as minimum
> and will only overwrite it when the driver-computed pitch is larger,
> allowing userspace to, intentionally or not, overallocate framebuffers.

As discussed on IRC, my concern with this is that some userspace applications 
might be relying on this behaviour. I'm not personally aware of any though, so 
I'm not opposed to this patch, but I can't vouch it won't cause any userspace 
breakage.

(On a side note I believe treating the pitch and size arguments as inputs 
could be a worthwhile extension to the API, but given that we haven't rejected 
incorrect values in the past we're pretty much stuck).

> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 5329491e32c3..6289e3797bc5
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -126,7 +126,7 @@ int rcar_du_dumb_create(struct drm_file *file, struct
> drm_device *dev, else
>  		align = 16 * args->bpp / 8;
> 
> -	args->pitch = roundup(max(args->pitch, min_pitch), align);
> +	args->pitch = roundup(min_pitch, align);
> 
>  	return drm_gem_cma_dumb_create_internal(file, dev, args);
>  }

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-11-06  0:13 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 13:25 [PATCH 0/7] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-05 13:25 ` [PATCH 1/7] drm/gem: Fix a few kerneldoc typos Thierry Reding
2014-11-05 14:18   ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 2/7] drm/doc: mm: Fix indentation Thierry Reding
2014-11-05 14:19   ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 3/7] drm/doc: Add GEM/CMA helpers to kerneldoc Thierry Reding
2014-11-05 14:34   ` Daniel Vetter
2014-11-05 15:01     ` Thierry Reding
2014-11-05 15:04       ` Daniel Vetter
2014-11-05 15:16         ` Thierry Reding
2014-11-05 13:25 ` [PATCH 4/7] drm/cma: Introduce drm_gem_cma_dumb_create_internal() Thierry Reding
2014-11-05 14:36   ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 5/7] drm/omap: gem: dumb: pitch is an output Thierry Reding
2014-11-05 14:38   ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 6/7] drm/rcar: " Thierry Reding
2014-11-05 14:39   ` Daniel Vetter
2014-11-05 18:47   ` Laurent Pinchart [this message]
2014-11-06  0:54     ` Russell King - ARM Linux
2014-11-06 18:17       ` Laurent Pinchart
2014-11-05 13:25 ` [PATCH 7/7] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-05 14:42   ` Daniel Vetter
2014-11-05 14:24 ` [PATCH 0/7] " Russell King - ARM Linux
2014-11-05 14:45   ` Thierry Reding
2014-11-05 15:01   ` Daniel Vetter
2014-11-06 15:49 ` [PATCH v2 0/8] " Thierry Reding
2014-11-06 15:49   ` [PATCH v2 1/8] drm/gem: Fix a few kerneldoc typos Thierry Reding
2014-11-06 15:49   ` [PATCH v2 2/8] drm/doc: mm: Fix indentation Thierry Reding
2014-11-06 15:49   ` [PATCH v2 3/8] drm/doc: Add GEM/CMA helpers to kerneldoc Thierry Reding
2014-11-06 20:05     ` Daniel Vetter
2014-11-06 15:49   ` [PATCH v2 4/8] drm/cma: Introduce drm_gem_cma_dumb_create_internal() Thierry Reding
2014-11-06 15:49   ` [PATCH v2 5/8] drm/omap: gem: dumb: pitch is an output Thierry Reding
2014-11-06 22:23     ` Rob Clark
2014-11-07  8:02     ` Tomi Valkeinen
2014-11-06 15:49   ` [PATCH v2 6/8] drm/rcar: " Thierry Reding
2014-11-06 15:49   ` [PATCH v2 7/8] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-06 15:49   ` [PATCH v2 8/8] drm/cma: Remove call to drm_gem_free_mmap_offset() Thierry Reding
2014-11-06 20:06     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617531.b7zcoqrk6C@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@redhat.com \
    --cc=archit@ti.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=thierry.reding@gmail.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.