drm/i915: add sanity check for partial view creation
Subsystems (2)
PATCH 1/1 drm/i915: add sanity check for partial view creation
When binding pages for a partial view we should check that the offset + size is valid relative to the size of the gem object.
v2: Don't use pages->nents to determine the page count (Tvrtko Ursulin)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
@@ -3493,6 +3493,10 @@ intel_partial_pages(const struct i915_ggtt_view *view,struct sg_page_iter obj_sg_iter;int ret = -ENOMEM ; +if (view->params.partial.offset + view->params.partial.size > + obj->base.size >>PAGE_SHIFT ) +return ERR_PTR (-EINVAL ); + st =kmalloc (sizeof (*st),GFP_KERNEL );if (!st) goto err_st_alloc;
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Matthew Auld
When binding pages for a partial view we should check that the offset + size is valid relative to the size of the gem object.
v2: Don't use
pages->nentsto determine the page count (Tvrtko Ursulin)Cc Joonas Lahtinen <[email protected]>Signed-off-by Matthew Auld <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c intel_partial_pages(const struct i915_ggtt_view *view, · line 3496
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0@@ -3493,6 +3493,10 @@ intel_partial_pages(const struct i915_ggtt_view *view,struct sg_page_iter obj_sg_iter;int ret = -ENOMEM ; + if (view->params.partial.offset + view->params.partial.size >
Handle overflow?
Why do it here and not at creation?
What bug are you fixing?
drivers/gpu/drm/i915/i915_gem_gtt.c intel_partial_pages(const struct i915_ggtt_view *view, · line 3498
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+ obj->base.size >> PAGE_SHIFT) +return ERR_PTR (-EINVAL );
Is this a user error? Or just an internal programming bug. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: add sanity check for partial view creation (rev2)
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/i915: add sanity check for partial view creation (rev2)
URL : https://patchwork.freedesktop.org/series/3926/
State : failure
== Summary ==
Series 3926v2 drm/i915: add sanity check for partial view creation
http://patchwork.freedesktop.org/api/1.0/series/3926/revisions/2/mbox/
Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
pass -> FAIL (snb-x220t)
Subgroup basic-plain-flip:
pass -> DMESG-WARN (hsw-brixbox)
Test kms_force_connector_basic:
Subgroup force-load-detect:
pass -> SKIP (ilk-hp8440p)
skip -> PASS (ivb-t430s)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-b:
pass -> DMESG-WARN (snb-x220t)
Subgroup nonblocking-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS (hsw-brixbox)
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (hsw-gt2)
Subgroup suspend-read-crc-pipe-c:
dmesg-warn -> PASS (bsw-nuc-2)
Test pm_rpm:
Subgroup basic-rte:
dmesg-warn -> PASS (snb-x220t)bdw-nuci7 total:169 pass:158 dwarn:0 dfail:0 fail:0 skip:11 bdw-ultra total:169 pass:155 dwarn:0 dfail:0 fail:0 skip:14 bsw-nuc-2 total:169 pass:138 dwarn:0 dfail:0 fail:1 skip:30 byt-nuc total:169 pass:144 dwarn:0 dfail:0 fail:0 skip:25 hsw-brixbox total:169 pass:153 dwarn:1 dfail:0 fail:0 skip:15 hsw-gt2 total:169 pass:159 dwarn:0 dfail:0 fail:0 skip:10 ilk-hp8440p total:169 pass:118 dwarn:0 dfail:0 fail:0 skip:51 ivb-t430s total:169 pass:154 dwarn:0 dfail:0 fail:0 skip:15 skl-i5k-2 total:169 pass:153 dwarn:0 dfail:0 fail:0 skip:16 skl-i7k-2 total:169 pass:153 dwarn:0 dfail:0 fail:0 skip:16 snb-dellxps total:169 pass:145 dwarn:1 dfail:0 fail:0 skip:23 snb-x220t total:169 pass:144 dwarn:1 dfail:0 fail:2 skip:22
Results at /archive/results/CI_IGT_test/Patchwork_1514/
db506392f6706faffdc965c53c4cdea58cc16a02 drm-intel-nightly: 2016y-03m-02d-13h-47m-11s UTC integration manifest ecd4e415d19a3d4542de9c6bc3f600416cffa50f drm/i915: add sanity check for partial view creation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 1 line
Handle overflow?
Okay, good idea.
Quoted 1 line
Why do it here and not at creation?
We could, given that we currently only exercise partial views in the gem fault handler code, but as Joonas mentioned we are expecting further use of partial views, so it makes sense to have the check in only one place.
Quoted 1 line
What bug are you fixing?
afaik this doesn't fix a bug, but it does seem like a reasonable sanity check to add, given more widespread use of partial views.
Quoted 1 line
Is this a user error? Or just an internal programming bug.
I think if we were to ever hit this it would be indicative of an internal programming bug.
________________________________________
From: Chris Wilson [[email protected]]
Sent: 02 March 2016 14:42
To: Auld, Matthew
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: add sanity check for partial view creation
Quoted 16 lines · Matthew Auld
When binding pages for a partial view we should check that the offset + size is valid relative to the size of the gem object.
v2: Don't use
pages->nentsto determine the page count (Tvrtko Ursulin)Cc Joonas Lahtinen <[email protected]>Signed-off-by Matthew Auld <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c intel_partial_pages(const struct i915_ggtt_view *view, · line 3496
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0@@ -3493,6 +3493,10 @@ intel_partial_pages(const struct i915_ggtt_view *view,struct sg_page_iter obj_sg_iter;int ret = -ENOMEM ; + if (view->params.partial.offset + view->params.partial.size >
Handle overflow?
Why do it here and not at creation?
What bug are you fixing?
drivers/gpu/drm/i915/i915_gem_gtt.c intel_partial_pages(const struct i915_ggtt_view *view, · line 3498
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+ obj->base.size >> PAGE_SHIFT) +return ERR_PTR (-EINVAL );
Is this a user error? Or just an internal programming bug. -Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Matthew
Quoted 1 line
Handle overflow?
Okay, good idea.
Quoted 1 line
Why do it here and not at creation?
We could, given that we currently only exercise partial views in the gem fault handler code, but as Joonas mentioned we are expecting further use of partial views, so it makes sense to have the check in only one place.
More use of broken code? Please review the patches to fix the current implementation first!
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx