public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields
@ 2015-02-11  7:44 Daniel Vetter
  2015-02-11 10:01 ` Chris Wilson
  2015-02-11 14:00 ` shuang.he
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-02-11  7:44 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

Forgotten ever since, but luckily we're at least good at memset.

Testecase: igt/gem_ctx_create/invalid-pad
Testecase: igt/gem_ctx_bad_destroy/invalid-pad
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 8603bf48d3ee..378011e4704d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -748,6 +748,11 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 	struct intel_context *ctx;
 	int ret;
 
+	if (args->pad) {
+		DRM_DEBUG_DRIVER("garbage in pad 0x%08x\n", args->pad);
+		return -EINVAL;
+	}
+
 	if (!contexts_enabled(dev))
 		return -ENODEV;
 
@@ -774,6 +779,11 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
 	struct intel_context *ctx;
 	int ret;
 
+	if (args->pad) {
+		DRM_DEBUG_DRIVER("garbage in pad 0x%08x\n", args->pad);
+		return -EINVAL;
+	}
+
 	if (args->ctx_id == DEFAULT_CONTEXT_HANDLE)
 		return -ENOENT;
 
-- 
1.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields
  2015-02-11  7:44 [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields Daniel Vetter
@ 2015-02-11 10:01 ` Chris Wilson
  2015-02-11 11:28   ` Daniel Vetter
  2015-02-11 14:00 ` shuang.he
  1 sibling, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2015-02-11 10:01 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development

On Wed, Feb 11, 2015 at 08:44:47AM +0100, Daniel Vetter wrote:
> Forgotten ever since, but luckily we're at least good at memset.
> 
> Testecase: igt/gem_ctx_create/invalid-pad
> Testecase: igt/gem_ctx_bad_destroy/invalid-pad
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

I wonder if we used mbz instead of pad, we would have a slightly more
obvious reminder to zero the fields.

Looks like pad is only cleared fortuituosly in current userspace though.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields
  2015-02-11 10:01 ` Chris Wilson
@ 2015-02-11 11:28   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-02-11 11:28 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Intel Graphics Development,
	Daniel Vetter

On Wed, Feb 11, 2015 at 10:01:33AM +0000, Chris Wilson wrote:
> On Wed, Feb 11, 2015 at 08:44:47AM +0100, Daniel Vetter wrote:
> > Forgotten ever since, but luckily we're at least good at memset.
> > 
> > Testecase: igt/gem_ctx_create/invalid-pad
> > Testecase: igt/gem_ctx_bad_destroy/invalid-pad
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> 
> I wonder if we used mbz instead of pad, we would have a slightly more
> obvious reminder to zero the fields.
> 
> Looks like pad is only cleared fortuituosly in current userspace though.

Oops, VG_CLEAR isn't as good as I've thought. Time to write more patches I
guess. But I expect that most compile libdrm with valgrind support, so I
still think we could try this out for 3.21 and see what happens ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields
  2015-02-11  7:44 [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields Daniel Vetter
  2015-02-11 10:01 ` Chris Wilson
@ 2015-02-11 14:00 ` shuang.he
  1 sibling, 0 replies; 4+ messages in thread
From: shuang.he @ 2015-02-11 14:00 UTC (permalink / raw)
  To: shuang.he, ethan.gao, intel-gfx, daniel.vetter

Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5757
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                 -1              281/281              280/281
ILK                                  313/313              313/313
SNB                 -3              309/322              306/322
IVB                 -3              380/380              377/380
BYT                 -3              296/296              293/296
HSW                 -3              426/426              423/426
BDW                 -4              318/318              314/318
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*PNV  igt_gen3_render_mixed_blits      PASS(2, M23)      CRASH(1, M23)
*SNB  igt_gem_ctx_basic      PASS(2, M22)      NSPT(1, M22)
*SNB  igt_gem_ctx_create      PASS(2, M22)      NSPT(1, M22)
*SNB  igt_gem_ctx_exec_basic      PASS(2, M22)      FAIL(1, M22)
*IVB  igt_gem_ctx_basic      PASS(2, M21)      NSPT(1, M21)
*IVB  igt_gem_ctx_create      PASS(2, M21)      NSPT(1, M21)
*IVB  igt_gem_ctx_exec_basic      PASS(2, M21)      FAIL(1, M21)
*BYT  igt_gem_ctx_basic      PASS(2, M50)      NSPT(1, M50)
*BYT  igt_gem_ctx_create      PASS(2, M50)      NSPT(1, M50)
*BYT  igt_gem_ctx_exec_basic      PASS(2, M50)      FAIL(1, M50)
*HSW  igt_gem_ctx_basic      PASS(2, M20)      NSPT(1, M20)
*HSW  igt_gem_ctx_create      PASS(2, M20)      NSPT(1, M20)
*HSW  igt_gem_ctx_exec_basic      PASS(2, M20)      FAIL(1, M20)
*BDW  igt_gem_ctx_basic      PASS(2, M30)      NSPT(1, M30)
*BDW  igt_gem_ctx_create      PASS(2, M30)      NSPT(1, M30)
*BDW  igt_gem_ctx_exec_basic      PASS(2, M30)      FAIL(1, M30)
*BDW  igt_gem_gtt_hog      PASS(2, M30)      DMESG_WARN(1, M30)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-11 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11  7:44 [PATCH] drm/i915: Reject garbage in unsed ctx create/destroy fields Daniel Vetter
2015-02-11 10:01 ` Chris Wilson
2015-02-11 11:28   ` Daniel Vetter
2015-02-11 14:00 ` shuang.he

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox