All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: properly sanity check batch_start_offset
Date: Thu, 05 Mar 2020 14:10:47 +0200	[thread overview]
Message-ID: <87tv333su0.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200304205143.106693-1-matthew.auld@intel.com>

Matthew Auld <matthew.auld@intel.com> writes:

> Check the edge case where batch_start_offset sits exactly on the batch
> size.
>
> Testcase: igt/gem_exec_params/invalid-batch-start-offset
> Fixes: 0b5372727be3 ("drm/i915/cmdparser: Use cached vmappings")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 7bb27f382af7..5247de18a3d0 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2714,7 +2714,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>  		goto err_vma;
>  	}
>  
> -	if (range_overflows_t(u64,
> +	if (eb.batch_start_offset == eb.batch->vma->size ||
> +	    range_overflows_t(u64,
>  			      eb.batch_start_offset, eb.batch_len,

Can we sanitize the batch_len apriori?

Not that this would not work,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

>  			      eb.batch->vma->size)) {
>  		drm_dbg(&i915->drm, "Attempting to use out-of-bounds batch\n");
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-03-05 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 20:51 [Intel-gfx] [PATCH] drm/i915: properly sanity check batch_start_offset Matthew Auld
2020-03-05 12:07 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2020-03-05 12:10 ` Mika Kuoppala [this message]
2020-03-05 12:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-03-06  1:27 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=87tv333su0.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.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.