All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Antonio Argenziano <antonio.argenziano@intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [RFC 1/4] tests/i915/gem_mmap_gtt: Add invalid parameters test
Date: Tue, 12 Mar 2019 22:18:00 +0000	[thread overview]
Message-ID: <155242908022.7740.12733971717353258944@skylake-alporthouse-com> (raw)
In-Reply-To: <a4440b2c-cb6a-579f-16a4-a465785e9440@intel.com>

Quoting Antonio Argenziano (2019-03-12 22:11:06)
> 
> 
> On 12/03/19 15:04, Chris Wilson wrote:
> > Quoting Antonio Argenziano (2019-03-12 21:57:35)
> >> Add a test for an invalid handle being passed to the IOCTL.
> >>
> >> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> >> ---
> >>   tests/i915/gem_mmap_gtt.c | 12 ++++++++++++
> >>   1 file changed, 12 insertions(+)
> >>
> >> diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
> >> index f6fbbe19..58f7403c 100644
> >> --- a/tests/i915/gem_mmap_gtt.c
> >> +++ b/tests/i915/gem_mmap_gtt.c
> >> @@ -831,6 +831,18 @@ igt_main
> >>          igt_fixture
> >>                  fd = drm_open_driver(DRIVER_INTEL);
> >>   
> >> +       igt_subtest("bad-object") {
> >> +               struct drm_i915_gem_mmap arg;
> >> +               int ret;
> >> +
> >> +               memset(&arg, 0, sizeof(arg));
> >> +               arg.handle = 0x10101010;
> > 
> > For bad handles, also try creating a valid handle and checking
> > for (i = 16; i < BITS_PER_TYPE(arg.handle); i++)
> >       arg.handle = real_handle | BIT(i);
> > 
> > Especially with (1<<31) set as historically the idr was only a 31-bit
> > cyclic allocator, so might be susceptible to wraparound.
> 
> Would:
> real_handle = gem_create(...);
> arg.handle = real_handle + 1;
> 
> guarantee an invalid handle?

If there's only been one handle allocated, yes.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-03-12 22:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 21:57 [igt-dev] [RFC 0/4] Improve mmap interface coverage Antonio Argenziano
2019-03-12 21:57 ` [igt-dev] [RFC 1/4] tests/i915/gem_mmap_gtt: Add invalid parameters test Antonio Argenziano
2019-03-12 22:04   ` Chris Wilson
2019-03-12 22:11     ` Antonio Argenziano
2019-03-12 22:18       ` Chris Wilson [this message]
2019-03-12 21:57 ` [igt-dev] [RFC 2/4] tests/i915/gem_mmap: Add invalid parameters tests Antonio Argenziano
2019-03-12 22:02   ` Chris Wilson
2019-03-12 22:13     ` Antonio Argenziano
2019-03-13 22:18     ` Antonio Argenziano
2019-03-13 22:52       ` Chris Wilson
2019-03-12 21:57 ` [igt-dev] [RFC 3/4] tests/i915/gem_mmap_wc: Add invalid params tests Antonio Argenziano
2019-03-12 21:57 ` [igt-dev] [RFC 4/4] tests/i915/prime_mmap: Add WC correctness test Antonio Argenziano
2019-03-12 22:07   ` Chris Wilson
2019-03-13 13:38 ` [igt-dev] ✓ Fi.CI.BAT: success for Improve mmap interface coverage Patchwork
2019-03-13 16:12 ` [igt-dev] ✓ Fi.CI.IGT: " 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=155242908022.7740.12733971717353258944@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=antonio.argenziano@intel.com \
    --cc=igt-dev@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.