Skip to contentSkip to conversation

drm/i915/userptr: reject zero user_size

PATCH In review Matthew Auld 3 participants 8 messages May 2, 2018 – May 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/userptr: reject zero user_size

Operating on a zero sized GEM userptr object will lead to explosions.

Fixes 5cc9ed4b9a7a ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_gem_userptr.c +3 -0
index d596a8302ca3..854bd51b9478 100644
@@ -778,6 +778,9 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
 			    I915_USERPTR_UNSYNCHRONIZED))
 		return -EINVAL;
 
+	if (!args->user_size)
+		return -EINVAL;
+
 	if (offset_in_page(args->user_ptr | args->user_size))
 		return -EINVAL;
 
Signature · 6 lines
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw

Quoting Matthew Auld (2018-05-02 19:16:17)

Quoted 5 lines

Operating on a zero sized GEM userptr object will lead to explosions.

Fixes 5cc9ed4b9a7a ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")
Cc Chris Wilson <[email protected]>

I could find no "but..." to save the day, so yes, it does look like we would let a 0 sized object through to the guts that never expect to see such a thing.

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915/userptr: reject zero user_size

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/userptr: reject zero user_size
URL : https://patchwork.freedesktop.org/series/42586/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4123 -> Patchwork_8879 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_8879 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8879, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42586/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8879:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_8879 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       PASS -> DMESG-WARN (fdo#105128)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-4200u:       PASS -> DMESG-FAIL (fdo#106103, fdo#102614)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-ivb-3520m:       PASS -> DMESG-WARN (fdo#106084)
      fi-cnl-psr:         PASS -> DMESG-WARN (fdo#104951)

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@kms_chamelium@dp-edid-read:
      fi-kbl-7500u:       FAIL (fdo#103841) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-ivb-3520m:       DMESG-WARN (fdo#106084) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         INCOMPLETE (fdo#103927) -> PASS

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103

== Participating hosts (40 -> 37) ==

Missing (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4123 -> Patchwork_8879

CI_DRM_4123: cbb6a0aa933f3323a8deb331aca503b7388abc06 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4456: 43761534c6482dc67b9c3d8eeecd425ef40b3c4c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8879: 31d4876d8d11dbee7ca1532848b0b8e84a123dab @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4456: 30b992bdc047073e1fe99b1ac622f026618a8081 @ git://anongit.freedesktop.org/piglit

== Linux commits ==

31d4876d8d11 drm/i915/userptr: reject zero user_size

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8879/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Matthew Auld

Quoting Matthew Auld (2018-05-02 19:16:17)

Quoted 5 lines

Operating on a zero sized GEM userptr object will lead to explosions.

Fixes 5cc9ed4b9a7a ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")
Cc Chris Wilson <[email protected]>

One thing missing for a user visible bug...
Testcase:
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

PATCH 1/1 drm/i915/userptr: reject zero user_size

In reply to Matthew Auld

Operating on a zero sized GEM userptr object will lead to explosions.

Fixes 5cc9ed4b9a7a ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")

Testcase: igt/gem_userptr_blits/input-checking

---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_gem_userptr.c +3 -0
index d596a8302ca3..854bd51b9478 100644
@@ -778,6 +778,9 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
 			    I915_USERPTR_UNSYNCHRONIZED))
 		return -EINVAL;
 
+	if (!args->user_size)
+		return -EINVAL;
+
 	if (offset_in_page(args->user_ptr | args->user_size))
 		return -EINVAL;
 
Signature · 6 lines
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Quoting Matthew Auld (2018-05-02 20:50:21)

Quoted 7 lines

Operating on a zero sized GEM userptr object will lead to explosions.

Fixes 5cc9ed4b9a7a ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")

Testcase: igt/gem_userptr_blits/input-checking

Picked up for pushing in the next wave. Thanks for the fix and testcase, -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

✓ Fi.CI.BAT: success for drm/i915/userptr: reject zero user_size (rev2)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/userptr: reject zero user_size (rev2)
URL : https://patchwork.freedesktop.org/series/42586/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4124 -> Patchwork_8882 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_8882 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8882, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42586/revisions/2/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8882:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_8882 that come from known issues:

=== IGT changes ===

    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-glk-j4005:       FAIL (fdo#104008) -> PASS

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008

== Participating hosts (39 -> 35) ==

Additional (1): fi-bxt-dsi
Missing (5): fi-byt-j1900 fi-cnl-y3 fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4124 -> Patchwork_8882

CI_DRM_4124: f8d7a96b18809b25ffc00bb9fd4245a0e826057b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4456: 43761534c6482dc67b9c3d8eeecd425ef40b3c4c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8882: 89127e9eb1cfe2972ef7f6d4baaeb47b742a3069 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4456: 30b992bdc047073e1fe99b1ac622f026618a8081 @ git://anongit.freedesktop.org/piglit

== Linux commits ==

89127e9eb1cf drm/i915/userptr: reject zero user_size

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8882/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

✓ Fi.CI.IGT: success for drm/i915/userptr: reject zero user_size (rev2)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/userptr: reject zero user_size (rev2)
URL : https://patchwork.freedesktop.org/series/42586/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4124_full -> Patchwork_8882_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_8882_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8882_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42586/revisions/2/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8882_full:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-blt:
      shard-kbl:          SKIP -> PASS +2

    igt@gem_mocs_settings@mocs-rc6-render:
      shard-kbl:          PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_8882_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105363)

    igt@kms_flip@modeset-vs-vblank-race:
      shard-glk:          PASS -> FAIL (fdo#103060)

    igt@kms_flip@plain-flip-ts-check:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_rotation_crc@sprite-rotation-270:
      shard-apl:          PASS -> FAIL (fdo#103925)

    
    ==== Possible fixes ====

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-apl:          FAIL (fdo#103375) -> PASS

    igt@kms_cursor_crc@cursor-64x64-dpms:
      shard-apl:          FAIL (fdo#103232, fdo#104645) -> PASS

    igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
      shard-hsw:          FAIL (fdo#104873) -> PASS

    igt@kms_flip@flip-vs-expired-vblank:
      shard-hsw:          FAIL (fdo#105707) -> PASS

    igt@kms_flip@plain-flip-ts-check-interruptible:
      shard-hsw:          FAIL (fdo#100368) -> PASS

    igt@kms_vblank@pipe-a-accuracy-idle:
      shard-hsw:          FAIL (fdo#102583) -> PASS

=== Piglit changes ===

    ==== Issues hit ====

    spec@arb_tessellation_shader@execution@variable-indexing@vs-output-array-float-index-wr-before-tcs:
      pig-glk-j4005:      NOTRUN -> FAIL (fdo#106148) +35

    [email protected]@execution@built-in-constants:
      pig-glk-j4005:      NOTRUN -> FAIL (fdo#106277)
      pig-hsw-4770r:      NOTRUN -> FAIL (fdo#106277)

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104645 https://bugs.freedesktop.org/show_bug.cgi?id=104645
fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105707 https://bugs.freedesktop.org/show_bug.cgi?id=105707
fdo#106148 https://bugs.freedesktop.org/show_bug.cgi?id=106148
fdo#106277 https://bugs.freedesktop.org/show_bug.cgi?id=106277

== Participating hosts (6 -> 8) ==

Additional (2): pig-glk-j4005 pig-hsw-4770r

== Build changes ==

* Linux: CI_DRM_4124 -> Patchwork_8882

CI_DRM_4124: f8d7a96b18809b25ffc00bb9fd4245a0e826057b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4456: 43761534c6482dc67b9c3d8eeecd425ef40b3c4c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8882: 89127e9eb1cfe2972ef7f6d4baaeb47b742a3069 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4456: 30b992bdc047073e1fe99b1ac622f026618a8081 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8882/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx