public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH] i915/gem_exec_params: add test_invalid_batch_start
Date: Thu, 05 Mar 2020 14:05:39 +0200	[thread overview]
Message-ID: <87wo7z3t2k.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200304205243.106854-1-matthew.auld@intel.com>

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

> Sanity check that kernel rejects too large batch_start_offset.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  tests/i915/gem_exec_params.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
> index cf7ea306..afc8d2c7 100644
> --- a/tests/i915/gem_exec_params.c
> +++ b/tests/i915/gem_exec_params.c
> @@ -268,6 +268,23 @@ static void mmapped(int i915)
>  	gem_close(i915, buf);
>  }
>  
> +static void test_invalid_batch_start(int fd)
> +{
> +	struct drm_i915_gem_exec_object2 exec = {
> +		.handle = batch_create(fd),
> +	};
> +	struct drm_i915_gem_execbuffer2 execbuf = {
> +		.buffers_ptr = to_user_pointer(&exec),
> +		.buffer_count = 1,
> +		.batch_start_offset = 4096, /* space jump */

If we could get batch size from the handle would be
more documentative.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> +	};
> +
> +	igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINVAL);
> +
> +	gem_sync(fd, exec.handle);
> +	gem_close(fd, exec.handle);
> +}
> +
>  struct drm_i915_gem_execbuffer2 execbuf;
>  struct drm_i915_gem_exec_object2 gem_exec[1];
>  uint32_t batch[2] = {MI_BATCH_BUFFER_END};
> @@ -507,6 +524,9 @@ igt_main
>  	igt_subtest("batch-first")
>  		test_batch_first(fd);
>  
> +	igt_subtest("invalid-batch-start-offset")
> +		test_invalid_batch_start(fd);
> +
>  #define DIRT(name) \
>  	igt_subtest(#name "-dirt") { \
>  		execbuf.flags = 0; \
> -- 
> 2.20.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 20:52 [igt-dev] [PATCH] i915/gem_exec_params: add test_invalid_batch_start Matthew Auld
2020-03-05  9:54 ` [igt-dev] ✗ GitLab.Pipeline: failure for " Patchwork
2020-03-05 10:04 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-03-05 12:05 ` Mika Kuoppala [this message]

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=87wo7z3t2k.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox