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)
v3: Handle potential overflow (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +7 -0
@@ -3493,6 +3493,13 @@ intel_partial_pages(const struct i915_ggtt_view *view,struct sg_page_iter obj_sg_iter;int ret = -ENOMEM ; +if (U64_MAX - view->params.partial.offset < view->params.partial.size) +return ERR_PTR (-ERANGE ); + +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 17 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)
v3: Handle potential overflow (Chris Wilson)Cc Joonas Lahtinen <[email protected]>Signed-off-by Matthew Auld <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++ 1 file changed, 7 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 3497
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -3493,6 +3493,13 @@ intel_partial_pages(const struct i915_ggtt_view *view,struct sg_page_iter obj_sg_iter;int ret = -ENOMEM ; +if (U64_MAX - view->params.partial.offset < view->params.partial.size) +return ERR_PTR (-ERANGE );
Idiomatically is this how we test for offset+size overflows?
drivers/gpu/drm/i915/i915_gem_gtt.c intel_partial_pages(const struct i915_ggtt_view *view, · line 3501
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +3
-0+if (view->params.partial.offset + view->params.partial.size > + obj->base.size >>PAGE_SHIFT ) +return ERR_PTR (-EINVAL );
This is still idiotic (placement, choice of runtime errors for a programmer error). If this concerns you that, please look at the API, and please review the outstanding patches.
-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
Quoted 1 line
If this concerns you that, please look at the API,
and please review the outstanding patches.
Could you elaborate on this please?
What patches are you referring to?
_______________________________________________
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 (rev3)
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/i915: add sanity check for partial view creation (rev3)
URL : https://patchwork.freedesktop.org/series/3926/
State : failure
== Summary ==
Series 3926v3 drm/i915: add sanity check for partial view creation
http://patchwork.freedesktop.org/api/1.0/series/3926/revisions/3/mbox/
Test gem_sync:
Subgroup basic-render:
pass -> INCOMPLETE (bdw-nuci7) UNSTABLE
Test kms_flip:
Subgroup basic-flip-vs-dpms:
dmesg-warn -> PASS (ilk-hp8440p) UNSTABLE
Subgroup basic-flip-vs-modeset:
dmesg-warn -> PASS (ilk-hp8440p) UNSTABLE
Subgroup basic-flip-vs-wf_vblank:
dmesg-warn -> PASS (hsw-brixbox)
Test kms_frontbuffer_tracking:
Subgroup basic:
fail -> PASS (bsw-nuc-2)
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-c:
dmesg-warn -> PASS (hsw-brixbox)
Subgroup read-crc-pipe-c-frame-sequence:
pass -> DMESG-WARN (hsw-brixbox)
Subgroup suspend-read-crc-pipe-b:
pass -> INCOMPLETE (hsw-gt2)
Test pm_rpm:
Subgroup basic-pci-d3-state:
fail -> DMESG-FAIL (snb-x220t)bdw-nuci7 total:95 pass:86 dwarn:0 dfail:0 fail:0 skip:8 bdw-ultra total:183 pass:165 dwarn:0 dfail:0 fail:0 skip:18 bsw-nuc-2 total:183 pass:149 dwarn:0 dfail:0 fail:0 skip:34 byt-nuc total:183 pass:152 dwarn:0 dfail:0 fail:0 skip:31 hsw-brixbox total:183 pass:163 dwarn:1 dfail:0 fail:0 skip:19 hsw-gt2 total:122 pass:109 dwarn:0 dfail:0 fail:0 skip:12 ilk-hp8440p total:183 pass:125 dwarn:0 dfail:0 fail:0 skip:58 ivb-t430s total:183 pass:162 dwarn:0 dfail:0 fail:0 skip:21 skl-i5k-2 total:183 pass:163 dwarn:0 dfail:0 fail:0 skip:20 skl-i7k-2 total:183 pass:163 dwarn:0 dfail:0 fail:0 skip:20 snb-dellxps total:183 pass:153 dwarn:1 dfail:0 fail:0 skip:29 snb-x220t total:183 pass:154 dwarn:0 dfail:1 fail:0 skip:28
Results at /archive/results/CI_IGT_test/Patchwork_1528/
91a38d589cb775a4486cec599413f581b2e8f437 drm-intel-nightly: 2016y-03m-03d-17h-31m-44s UTC integration manifest c8149964b8e93364a1cf6ff2baa5339e8b891b0c drm/i915: add sanity check for partial view creation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx