All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	intel-gfx@lists.freedesktop.org, Adam Jackson <ajax@redhat.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 02/10] drm/uapi: Validate the mode flags/type
Date: Tue, 14 Nov 2017 20:46:07 +0200	[thread overview]
Message-ID: <20171114184607.GM10981@intel.com> (raw)
In-Reply-To: <151068492654.23340.806086868902426880@mail.alporthouse.com>

On Tue, Nov 14, 2017 at 06:42:06PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2017-11-14 18:32:50)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Currently userspace is allowed to feed in any king of garbage in the
> > high bits of the mode flags/type, as are drivers when probing modes.
> > Reject any mode with bogus flags/type.
> > 
> > Hopefully this won't break any current userspace...
> > 
> > Cc: Jose Abreu <Jose.Abreu@synopsys.com>
> > Cc: Adam Jackson <ajax@redhat.com>
> > Cc: Keith Packard <keithp@keithp.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_modes.c |  4 ++++
> >  include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++
> >  2 files changed, 28 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index 1a72883b836e..f99ba963fb3e 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -1036,6 +1036,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
> >  enum drm_mode_status
> >  drm_mode_validate_basic(const struct drm_display_mode *mode)
> >  {
> > +       if (mode->type & ~DRM_MODE_TYPE_ALL ||
> > +           mode->flags & ~DRM_MODE_FLAG_ALL)
> > +               return MODE_BAD;
> 
> I had to read this twice to realise they were different masks. (If the
> start and end of a word match expectations, the eye skips the middle.)
> Can we split this up into two separate ifs, so the reader doesn't fall
> into this trap :)

Sure, I can split that up.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-11-14 18:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 18:32 [PATCH 00/10] drm/uapi: Validate mode flags/type, and deprecate some of them Ville Syrjala
2017-11-14 18:32 ` [PATCH 01/10] drm/modes: Move 3D stereo flag check into drm_mode_validate_basic() Ville Syrjala
2017-11-14 19:22   ` Alex Deucher
2017-11-14 18:32 ` [PATCH 02/10] drm/uapi: Validate the mode flags/type Ville Syrjala
2017-11-14 18:42   ` [Intel-gfx] " Chris Wilson
2017-11-14 18:46     ` Ville Syrjälä [this message]
2017-11-15 15:49   ` [PATCH v2 " Ville Syrjala
2017-11-15 17:38     ` Alex Deucher
2017-11-15 18:02     ` Jose Abreu
2017-11-15 18:11       ` Ville Syrjälä
2018-03-21 20:45   ` drm-next xf86-video-vmware breakage Was [PATCH " Thomas Hellstrom
2018-03-21 20:51     ` Ville Syrjälä
2018-03-21 21:06       ` Thomas Hellstrom
2017-11-14 18:32 ` [PATCH 03/10] drm/uapi: Deprecate DRM_MODE_FLAG_PIXMUX Ville Syrjala
2017-11-14 19:12   ` Alex Deucher
2017-11-15 18:05   ` Jose Abreu
2017-11-14 18:32 ` [PATCH 04/10] drm/uapi: Deprecate DRM_MODE_FLAG_BCAST Ville Syrjala
2017-11-14 19:13   ` Alex Deucher
2017-11-15 18:05   ` Jose Abreu
2017-11-14 18:32 ` [PATCH 05/10] drm/modes: Fix description of DRM_MODE_TYPE_USERDEF Ville Syrjala
2017-11-14 19:32   ` Alex Deucher
2017-11-14 18:32 ` [PATCH 06/10] drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C vs. DRM_MODE_TYPE_BUILTIN handling Ville Syrjala
2017-11-14 18:43   ` Chris Wilson
2017-11-14 19:16     ` Alex Deucher
2017-11-14 18:32 ` [PATCH 07/10] drm/modes: Kill DRM_MODE_TYPE_CLOCK_CRTC_C define Ville Syrjala
2017-11-14 19:17   ` Alex Deucher
2017-11-14 18:32 ` [PATCH 08/10] drm/uapi: Deprecate nonsense kms mode types Ville Syrjala
2017-11-14 19:19   ` Alex Deucher
2017-11-14 20:43   ` Adam Jackson
     [not found]   ` <20171115154504.14338-1-ville.syrjala@linux.intel.com>
2017-11-15 18:04     ` [PATCH v2 " Jose Abreu
2017-11-14 18:32 ` [PATCH 09/10] drm/modes: Provide global mode_valid hook Ville Syrjala
2017-11-20  8:00   ` Daniel Vetter
2017-11-14 18:32 ` [PATCH 10/10] drm/i915: Provide a device level .mode_valid() hook Ville Syrjala
2017-11-20  8:01   ` Daniel Vetter
2017-11-20  8:02     ` Daniel Vetter
2017-11-14 19:13 ` ✓ Fi.CI.BAT: success for drm/uapi: Validate mode flags/type, and deprecate some of them Patchwork
2017-11-14 21:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-11-15 16:11 ` ✓ Fi.CI.BAT: success for drm/uapi: Validate mode flags/type, and deprecate some of them (rev2) Patchwork
2017-11-15 17:12 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-01-29 20:12 ` [PATCH 00/10] drm/uapi: Validate mode flags/type, and deprecate some of them Ville Syrjälä

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=20171114184607.GM10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=ajax@redhat.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.