drm/i915: Reject unknown syncobj flags
Subsystems (3)
Tvrtko Ursulin
maintainerPATCH 1/3 drm/i915: Reject unknown syncobj flags
From: Tvrtko Ursulin <[email protected]>
We have to reject unknown flags for uAPI considerations, and also because the curent implementation limits their i915 storage space to two bits.
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +5 -0
@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, goto err; } + if (fence.flags & ~((typeof(fence.flags))2)) { + err = -EINVAL ; + goto err; + } + syncobj =drm_syncobj_find (file, fence.handle);if (!syncobj) {DRM_DEBUG ("Invalid syncobj handle provided\n" );
Signature · 6 lines
2.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH 2/3 drm/i915: Fortify ptr_pack_bits against mistakes
From: Tvrtko Ursulin <[email protected]>
Mask out the bits which do not fit into the specified width in order to avoid corrupting the stored pointer.
--- drivers/gpu/drm/i915/i915_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_utils.h +1 -1
@@ -84,7 +84,7 @@ })#define ptr_pack_bits (ptr, bits, n) \ - ((typeof(ptr))((unsigned long)(ptr) | (bits))) + ((typeof(ptr))((unsigned long)(ptr) | ((bits) & (BIT(n) - 1))))#define page_mask_bits (ptr) ptr_mask_bits(ptr, PAGE_SHIFT)#define page_unmask_bits (ptr) ptr_unmask_bits(ptr, PAGE_SHIFT)
Signature · 6 lines
2.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH 3/3 drm/i915: Warn in debug builds of incorrect usages of ptr_pack_bits
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
GEM_BUG_ON if the packed bits do not fit into the specified width.
--- drivers/gpu/drm/i915/i915_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_utils.h +4 -2
@@ -83,8 +83,10 @@ (typeof (ptr))(__v & -BIT (n)); \ }) -#define ptr_pack_bits (ptr, bits, n) \ - ((typeof(ptr))((unsigned long)(ptr) | ((bits) & (BIT(n) - 1)))) +#define ptr_pack_bits (ptr, bits, n) ({ \ + GEM_BUG_ON((bits) & -BIT(n)); \ + ((typeof(ptr))((unsigned long)(ptr) | ((bits) & (BIT(n) - 1)))); \ +})#define page_mask_bits (ptr) ptr_mask_bits(ptr, PAGE_SHIFT)#define page_unmask_bits (ptr) ptr_unmask_bits(ptr, PAGE_SHIFT)
Signature · 6 lines
2.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Warn in debug builds of incorrect usages of ptr_pack_bits
Quoting Tvrtko Ursulin (2017-10-27 14:40:14)
Quoted 14 lines
From: Tvrtko Ursulin <[email protected]>
GEM_BUG_ONif the packed bits do not fit into the specified width.Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/i915_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_utils.h +0
-0
drivers/gpu/drm/i915/i915_utils.h line 88
Quoted 8 lines
drivers/gpu/drm/i915/i915_utils.h +3
-2@@ -83,8 +83,10 @@ (typeof (ptr))(__v & -BIT (n)); \ }) -#define ptr_pack_bits (ptr, bits, n) \ - ((typeof(ptr))((unsigned long)(ptr) | ((bits) & (BIT(n) - 1)))) +#define ptr_pack_bits (ptr, bits, n) ({ \ + GEM_BUG_ON((bits) & -BIT(n)); \ + ((typeof(ptr))((unsigned long)(ptr) | ((bits) & (BIT(n) - 1)))); \
With that you do not need the redundant mask. So don't. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tvrtko Ursulin (2017-10-27 14:40:12)
Quoted 25 lines
From: Tvrtko Ursulin <[email protected]>
We have to reject unknown flags for uAPI considerations, and also because the curent implementation limits their i915 storage space to two bits.
Signed-off-by Tvrtko Ursulin <[email protected]>Fixes cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")Cc Jason Ekstrand <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc David Airlie <[email protected]>--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/i915/i915_gem_execbuffer.c +0
-0
drivers/gpu/drm/i915/i915_gem_execbuffer.c get_fence_array(struct drm_i915_gem_execbuffer2 *args, · line 2102
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +0
-0@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, goto err; }
Make the test explicit for the abi:
drivers/gpu/drm/i915/i915_gem_execbuffer.c get_fence_array(struct drm_i915_gem_execbuffer2 *args, · line 2103
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1
-0+ if (fence.flags & ~((typeof(fence.flags))2)) {
s/2/3/!
if (fence.flags & ~(I915_EXEC_FENCE_WAIT | I915_EXEC_FENCE_SIGNAL)) {
drivers/gpu/drm/i915/i915_gem_execbuffer.c get_fence_array(struct drm_i915_gem_execbuffer2 *args, · line 2107
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +4
-0+ err = -EINVAL ; + goto err; + } +
BUILD_BUG_ON((I915_EXEC_FENCE_WAIT | I915_EXEC_FENCE_SIGNAL)) & ~(alignof(void *)-1)) ?
#define I915_EXEC_FENCE_FLAGS ... ?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v2 1/3 drm/i915: Reject unknown syncobj flags
From: Tvrtko Ursulin <[email protected]>
We have to reject unknown flags for uAPI considerations, and also because the curent implementation limits their i915 storage space to two bits.
v2: (Chris Wilson)
* Fix fail in ABI check.
* Added unknown flags and BUILD_BUG_ON.
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 ++++++++ include/uapi/drm/i915_drm.h | 1 + 2 files changed, 9 insertions(+)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +8 -0
@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, goto err; } +if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) { + err = -EINVAL ; + goto err; + } + syncobj =drm_syncobj_find (file, fence.handle);if (!syncobj) {DRM_DEBUG ("Invalid syncobj handle provided\n" );
@@ -2107,6 +2112,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, goto err; } +BUILD_BUG_ON (~(__alignof__(void *) -1 ) & + ~__I915_EXEC_FENCE_UNKNOWN_FLAGS); + fences[n] =ptr_pack_bits (syncobj, fence.flags,2 ); }
include/uapi/drm/i915_drm.h +1 -0
@@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence {#define I915_EXEC_FENCE_WAIT (1<<0)#define I915_EXEC_FENCE_SIGNAL (1<<1) +#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))__u32 flags; };
Signature · 6 lines
2.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Reject unknown syncobj flags
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Reject unknown syncobj flags
URL : https://patchwork.freedesktop.org/series/32755/
State : failure
== Summary ==
Series 32755v1 series starting with [1/3] drm/i915: Reject unknown syncobj flags
https://patchwork.freedesktop.org/api/1.0/series/32755/revisions/1/mbox/
Test chamelium:
Subgroup dp-crc-fast:
pass -> FAIL (fi-kbl-7500u) fdo#102514
Test gem_exec_fence:
Subgroup await-hang-default:
pass -> INCOMPLETE (fi-glk-dsi)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-gdg-551) fdo#102618fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:446s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:460s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:373s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:522s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:267s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:507s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:497s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:499s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:495s fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:604s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:420s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:252s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:583s fi-glk-dsi total:58 pass:42 dwarn:0 dfail:0 fail:0 skip:15 fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:429s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:429s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:424s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:495s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:462s fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:480s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:574s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:587s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:546s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:456s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:591s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:646s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:524s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:455s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:565s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:420s
795d258e67f403ff77d1f14b37551e98163f5b4e drm-tip: 2017y-10m-27d-11h-42m-39s UTC integration manifest 7570d46bd080 drm/i915: Warn in debug builds of incorrect usages of ptr_pack_bits 986f7accc9f4 drm/i915: Fortify ptr_pack_bits against mistakes5a26a3df1449 drm/i915: Reject unknown syncobj flags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6233/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags (rev2)
URL : https://patchwork.freedesktop.org/series/32755/
State : failure
== Summary ==
Series 32755v2 series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags
https://patchwork.freedesktop.org/api/1.0/series/32755/revisions/2/mbox/
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-gdg-551) fdo#102618
Subgroup basic-flip-after-cursor-varying-size:
pass -> INCOMPLETE (fi-cnl-y)
Test drv_module_reload:
Subgroup basic-no-display:
pass -> DMESG-WARN (fi-bsw-n3050)fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:457s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:450s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:378s fi-bsw-n3050 total:289 pass:242 dwarn:1 dfail:0 fail:0 skip:46 time:532s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:264s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:494s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:504s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:497s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:475s fi-cnl-y total:289 pass:192 dwarn:0 dfail:0 fail:0 skip:20 fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:417s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:250s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:578s fi-glk-dsi total:289 pass:258 dwarn:0 dfail:0 fail:1 skip:30 time:493s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:427s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:428s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:419s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:495s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:460s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:575s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:583s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:545s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:460s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:593s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:651s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:518s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:501s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:457s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:562s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:418s
795d258e67f403ff77d1f14b37551e98163f5b4e drm-tip: 2017y-10m-27d-11h-42m-39s UTC integration manifest c776b8035dbb drm/i915: Warn in debug builds of incorrect usages of ptr_pack_bits c85218fcc589 drm/i915: Fortify ptr_pack_bits against mistakes02f088699bf1 drm/i915: Reject unknown syncobj flags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6236/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags (rev2)
URL : https://patchwork.freedesktop.org/series/32755/
State : success
== Summary ==
Series 32755v2 series starting with [v2,1/3] drm/i915: Reject unknown syncobj flags
https://patchwork.freedesktop.org/api/1.0/series/32755/revisions/2/mbox/
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-gdg-551) fdo#102618fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:445s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:450s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:374s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:529s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:268s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:496s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:502s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:497s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:479s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:428s fi-gdg-551 total:289 pass:177 dwarn:1 dfail:0 fail:2 skip:109 time:258s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:582s fi-glk-dsi total:289 pass:258 dwarn:0 dfail:0 fail:1 skip:30 time:486s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:431s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:426s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:423s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:504s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:462s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:575s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:586s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:551s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:455s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:591s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:645s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:521s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:501s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:460s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:557s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:425s
d0582552491e17f5e386747f82147c1f2d9158c9 drm-tip: 2017y-10m-27d-19h-16m-21s UTC integration manifest 96d93f988c3b drm/i915: Warn in debug builds of incorrect usages of ptr_pack_bits f4dbb4df0b31 drm/i915: Fortify ptr_pack_bits against mistakesaa55311c1809 drm/i915: Reject unknown syncobj flags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6258/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx