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. v3: * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson)
Unified · Split
| @@ -2104,6 +2104,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, · 2103 unmodified lines | |||
| 2104 | goto err; | 2104 | goto err; |
| 2105 | } | 2105 | } |
| 2106 | 2106 | ||
| 2107 | if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) { | ||
| 2108 | err = -EINVAL; | ||
| 2109 | goto err; | ||
| 2110 | } | ||
| 2111 | |||
| 2107 | syncobj = drm_syncobj_find(file, fence.handle); | 2112 | syncobj = drm_syncobj_find(file, fence.handle); |
| 2108 | if (!syncobj) { | 2113 | if (!syncobj) { |
| 2109 | DRM_DEBUG("Invalid syncobj handle provided\n"); | 2114 | DRM_DEBUG("Invalid syncobj handle provided\n"); |
| @@ -2111,6 +2116,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, · 1 unmodified line | |||
| 2111 | goto err; | 2116 | goto err; |
| 2112 | } | 2117 | } |
| 2113 | 2118 | ||
| 2119 | BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) & | ||
| 2120 | ~__I915_EXEC_FENCE_UNKNOWN_FLAGS); | ||
| 2121 | |||
| 2114 | fences[n] = ptr_pack_bits(syncobj, fence.flags, 2); | 2122 | fences[n] = ptr_pack_bits(syncobj, fence.flags, 2); |
| 2115 | } | 2123 | } |
| 2116 | 2124 | ||
| @@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence { · 838 unmodified lines | |||
| 839 | 839 | ||
| 840 | #define I915_EXEC_FENCE_WAIT (1<<0) | 840 | #define I915_EXEC_FENCE_WAIT (1<<0) |
| 841 | #define I915_EXEC_FENCE_SIGNAL (1<<1) | 841 | #define I915_EXEC_FENCE_SIGNAL (1<<1) |
| 842 | #define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) | ||
| 842 | __u32 flags; | 843 | __u32 flags; |
| 843 | }; | 844 | }; |
| 844 | 845 | ||