Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
v16 cover Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
This patch series fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation, etc. We need to check that we avoid integer overflows when looking up a page, and so fix all the instances where we have mistakenly used a plain integer instead of a more suitable long.
And there is an impedance mismatch between the scatterlist API using unsigned int and our memory/page accounting in unsigned long. That is we may try to create a scatterlist for a large object that overflows returning a small table into which we try to fit very many pages. As the object size is under the control of userspace, we have to be prudent and catch the conversion errors. To catch the implicit truncation as we switch from unsigned long into the scatterlist's unsigned int, we use improved overflows_type check and report E2BIG prior to the operation. This is already used in our create ioctls to indicate if the uABI request is simply too large for the backing store.
And ttm place also has the same problem with scatterlist creation, and we fix the integer truncation problem with the way approached by scatterlist creation.
And It corrects the error code to return -E2BIG when creating gem objects using ttm or shmem, if the size is too large in each case.
Compared to the v15 version patch series[1], there is no code modification in this version patch series. Among the warnings reported by CI.CHECKPATCH, this patch fixes the parts that need fixing.
Fix "ERROR:SPACING" Checkpatch report
Fix "WARNING:COMMIT_LOG_LONG_LINE" Checkpatch report
[1] https://patchwork.freedesktop.org/series/112270/
Chris Wilson (3):
drm/i915/gem: Typecheck page lookups
drm/i915: Check for integer truncation on scatterlist creation drm/i915: Remove truncation warning for large objects
Gwan-gyeong Mun (3):
drm/i915: Check for integer truncation on the configuration of ttm
place
drm/i915: Check if the size is too big while creating shmem file drm/i915: Use error code as -E2BIG when the size of gem ttm object is
too large
drivers/gpu/drm/i915/gem/i915_gem_internal.c | 7 +- drivers/gpu/drm/i915/gem/i915_gem_object.c | 7 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 303 +++++++++++++++--- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 27 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 4 + drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 23 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 20 +- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 6 +- .../drm/i915/gem/selftests/huge_gem_object.c | 6 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 8 + .../drm/i915/gem/selftests/i915_gem_context.c | 12 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 8 +- .../drm/i915/gem/selftests/i915_gem_object.c | 8 +- drivers/gpu/drm/i915/gvt/dmabuf.c | 10 +- drivers/gpu/drm/i915/i915_gem.c | 18 +- drivers/gpu/drm/i915/i915_scatterlist.c | 9 + drivers/gpu/drm/i915/i915_vma.c | 8 +- drivers/gpu/drm/i915/intel_region_ttm.c | 14 + drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 + drivers/gpu/drm/i915/selftests/scatterlist.c | 4 + 20 files changed, 420 insertions(+), 86 deletions(-)
Signature · 1 line
2.37.1
PATCH v16 1/6 drm/i915/gem: Typecheck page lookups
From: Chris Wilson <[email protected]>
We need to check that we avoid integer overflows when looking up a page, and so fix all the instances where we have mistakenly used a plain integer instead of a more suitable long. Be pedantic and add integer typechecking to the lookup so that we can be sure that we are safe. And it also uses pgoff_t as our page lookups must remain compatible with the page cache, pgoff_t is currently exactly unsigned long.
v2: Move added i915_utils's macro into drm_util header (Jani N)
v3: Make not use the same macro name on a function. (Mauro)
For kernel-doc, macros and functions are handled in the same namespace, the same macro name on a function prevents ever adding documentation for it.
v4: Add kernel-doc markups to the kAPI functions and macros (Mauoro)
v5: Fix an alignment to match open parenthesis
v6: Rebase
v10: Use assert_typable instead of exactly_pgoff_t() macro. (Kees)
v11: Change the use of assert_typable to assert_same_typable (G.G)
v12: Change to use static_assert(__castable_to_type(n ,T)) style since
the assert_same_typable() macro has been dropped. (G.G)
v13: Change the use of __castable_to_type() to castable_to_type()
Remove an unnecessary header include line. (G.G)
v16: Fix "ERROR:SPACING" Checkpatch report (G.G)
--- drivers/gpu/drm/i915/gem/i915_gem_object.c | 7 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 293 ++++++++++++++++-- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 27 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- .../drm/i915/gem/selftests/i915_gem_context.c | 12 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 8 +- .../drm/i915/gem/selftests/i915_gem_object.c | 8 +- drivers/gpu/drm/i915/i915_gem.c | 18 +- drivers/gpu/drm/i915/i915_vma.c | 8 +- 9 files changed, 322 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +5 -2
@@ -427,10 +427,11 @@ void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,static void i915_gem_object_read_from_page_kmap (struct drm_i915_gem_object *obj,u64 offset,void *dst,int size) { +pgoff_t idx = offset >>PAGE_SHIFT ;void *src_map;void *src_ptr; - src_map =kmap_atomic (i915_gem_object_get_page (obj, offset >>PAGE_SHIFT )); + src_map =kmap_atomic (i915_gem_object_get_page (obj, idx)); src_ptr = src_map +offset_in_page (offset);if (!(obj->cache_coherent &I915_BO_CACHE_COHERENT_FOR_READ ))
@@ -443,9 +444,10 @@ i915_gem_object_read_from_page_kmap(struct drm_i915_gem_object *obj, u64 offset,static void i915_gem_object_read_from_page_iomap (struct drm_i915_gem_object *obj,u64 offset,void *dst,int size) { +pgoff_t idx = offset >>PAGE_SHIFT ; +dma_addr_t dma =i915_gem_object_get_dma_address (obj, idx);void __iomem *src_map;void __iomem *src_ptr; -dma_addr_t dma =i915_gem_object_get_dma_address (obj, offset >>PAGE_SHIFT ); src_map = io_mapping_map_wc(&obj->mm.region->iomap, dma - obj->mm.region->region.start,
@@ -484,6 +486,7 @@ static bool object_has_mappable_iomem(struct drm_i915_gem_object *obj)*/ int i915_gem_object_read_from_page (struct drm_i915_gem_object *obj,u64 offset,void *dst,int size) { +GEM_BUG_ON (overflows_type (offset >>PAGE_SHIFT , pgoff_t));GEM_BUG_ON (offset >= obj->base.size);GEM_BUG_ON (offset_in_page (offset) >PAGE_SIZE - size);GEM_BUG_ON (!i915_gem_object_has_pinned_pages (obj));
drivers/gpu/drm/i915/gem/i915_gem_object.h +270 -23
322 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_pages.c +13 -14
@@ -521,14 +521,16 @@ void __i915_gem_object_release_map(struct drm_i915_gem_object *obj) }struct scatterlist * -__i915_gem_object_get_sg (struct drm_i915_gem_object *obj, -struct i915_gem_object_page_iter *iter, -unsigned int n, -unsigned int *offset, -bool dma) +__i915_gem_object_page_iter_get_sg (struct drm_i915_gem_object *obj, +struct i915_gem_object_page_iter *iter, +pgoff_t n, +unsigned int *offset) + { -struct scatterlist *sg; +const bool dma = iter == &obj->mm.get_dma_page || + iter == &obj->ttm.get_io_page;unsigned int idx, count; +struct scatterlist *sg;might_sleep ();GEM_BUG_ON (n >= obj->base.size >>PAGE_SHIFT );
@@ -636,7 +638,7 @@ __i915_gem_object_get_sg(struct drm_i915_gem_object *obj, }struct page * -i915_gem_object_get_page (struct drm_i915_gem_object *obj,unsigned int n) +__i915_gem_object_get_page (struct drm_i915_gem_object *obj,pgoff_t n) {struct scatterlist *sg;unsigned int offset;
@@ -649,8 +651,7 @@ i915_gem_object_get_page(struct drm_i915_gem_object *obj, unsigned int n)/* Like i915_gem_object_get_page(), but mark the returned page dirty */ struct page * -i915_gem_object_get_dirty_page (struct drm_i915_gem_object *obj, -unsigned int n) +__i915_gem_object_get_dirty_page (struct drm_i915_gem_object *obj,pgoff_t n) {struct page *page;
@@ -662,9 +663,8 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, }dma_addr_t -i915_gem_object_get_dma_address_len (struct drm_i915_gem_object *obj, -unsigned long n, -unsigned int *len) +__i915_gem_object_get_dma_address_len (struct drm_i915_gem_object *obj, +pgoff_t n,unsigned int *len) {struct scatterlist *sg;unsigned int offset;
@@ -678,8 +678,7 @@ i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, }dma_addr_t -i915_gem_object_get_dma_address (struct drm_i915_gem_object *obj, -unsigned long n) +__i915_gem_object_get_dma_address (struct drm_i915_gem_object *obj,pgoff_t n) {return i915_gem_object_get_dma_address_len (obj, n,NULL ); }
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +1 -1
@@ -692,7 +692,7 @@ static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo,GEM_WARN_ON (bo->ttm); base = obj->mm.region->iomap.base - obj->mm.region->region.start; - sg =__i915_gem_object_get_sg (obj, &obj->ttm.get_io_page, page_offset, &ofs, true); + sg =i915_gem_object_page_iter_get_sg (obj, &obj->ttm.get_io_page, page_offset, &ofs);return ((base +sg_dma_address (sg)) >>PAGE_SHIFT ) + ofs; }
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +7 -5
@@ -469,7 +469,8 @@ static int gpu_fill(struct intel_context *ce,static int cpu_fill (struct drm_i915_gem_object *obj,u32 value) {const bool has_llc =HAS_LLC (to_i915 (obj->base.dev)); -unsigned int n, m, need_flush; +unsigned int need_flush; +unsigned long n, m;int err;i915_gem_object_lock (obj,NULL );
@@ -499,7 +500,8 @@ static int cpu_fill(struct drm_i915_gem_object *obj, u32 value) static noinline int cpu_check(struct drm_i915_gem_object *obj,unsigned int idx,unsigned int max) { -unsigned int n, m, needs_flush; +unsigned int needs_flush; +unsigned long n;int err;i915_gem_object_lock (obj,NULL );
@@ -508,7 +510,7 @@ static noinline int cpu_check(struct drm_i915_gem_object *obj, goto out_unlock;for (n =0 ; n <real_page_count (obj); n++) { -u32 *map; +u32 *map, m; map =kmap_atomic (i915_gem_object_get_page (obj, n));if (needs_flush &CLFLUSH_BEFORE )
@@ -516,7 +518,7 @@ static noinline int cpu_check(struct drm_i915_gem_object *obj,for (m =0 ; m < max; m++) {if (map[m] != m) { -pr_err ("%pS: Invalid value at object %d page %d/%ld, offset %d/%d: found %x expected %x\n" , +pr_err ("%pS: Invalid value at object %d page %ld/%ld, offset %d/%d: found %x expected %x\n" ,__builtin_return_address (0 ), idx, n,real_page_count (obj), m, max, map[m], m);
@@ -527,7 +529,7 @@ static noinline int cpu_check(struct drm_i915_gem_object *obj,for (; m <DW_PER_PAGE ; m++) {if (map[m] !=STACK_MAGIC ) { -pr_err ("%pS: Invalid value at object %d page %d, offset %d: found %x expected %x (uninitialised)\n" , +pr_err ("%pS: Invalid value at object %d page %ld, offset %d: found %x expected %x (uninitialised)\n" ,__builtin_return_address (0 ), idx, n, m, map[m],STACK_MAGIC ); err = -EINVAL ;
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +4 -4
@@ -97,11 +97,11 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj,struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct i915_gtt_view view;struct i915_vma *vma; +unsigned long offset;unsigned long page;u32 __iomem *io;struct page *p;unsigned int n; -u64 offset;u32 *cpu;int err;
@@ -158,7 +158,7 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj, cpu =kmap (p) +offset_in_page (offset);drm_clflush_virt_range (cpu,sizeof (*cpu));if (*cpu != (u32 )page) { - pr_err("Partial view for %lu [%u] (offset=%llu, size=%u [%llu, row size %u], fence=%d, tiling=%d, stride=%d) misalignment, expected write to page (%llu + %u [0x%llx]) of 0x%x, found 0x%x\n", + pr_err("Partial view for %lu [%u] (offset=%llu, size=%u [%llu, row size %u], fence=%d, tiling=%d, stride=%d) misalignment, expected write to page (%lu + %u [0x%lx]) of 0x%x, found 0x%x\n", page, n, view.partial.offset, view.partial.size,
@@ -214,10 +214,10 @@ static int check_partial_mappings(struct drm_i915_gem_object *obj,for_each_prime_number_from (page,1 , npages) {struct i915_gtt_view view =compute_partial_view (obj, page,MIN_CHUNK_PAGES ); +unsigned long offset;u32 __iomem *io;struct page *p;unsigned int n; -u64 offset;u32 *cpu;GEM_BUG_ON (view.partial.size > nreal);
@@ -254,7 +254,7 @@ static int check_partial_mappings(struct drm_i915_gem_object *obj, cpu =kmap (p) +offset_in_page (offset);drm_clflush_virt_range (cpu,sizeof (*cpu));if (*cpu != (u32 )page) { - pr_err("Partial view for %lu [%u] (offset=%llu, size=%u [%llu, row size %u], fence=%d, tiling=%d, stride=%d) misalignment, expected write to page (%llu + %u [0x%llx]) of 0x%x, found 0x%x\n", + pr_err("Partial view for %lu [%u] (offset=%llu, size=%u [%llu, row size %u], fence=%d, tiling=%d, stride=%d) misalignment, expected write to page (%lu + %u [0x%lx]) of 0x%x, found 0x%x\n", page, n, view.partial.offset, view.partial.size,
drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c +4 -4
@@ -33,10 +33,10 @@ static int igt_gem_object(void *arg)static int igt_gem_huge (void *arg) { -const unsigned int nreal =509 ;/* just to be awkward */ +const unsigned long nreal =509 ;/* just to be awkward */ struct drm_i915_private *i915 = arg;struct drm_i915_gem_object *obj; -unsigned int n; +unsigned long n;int err;/* Basic sanitycheck of our huge fake object allocation */
@@ -49,7 +49,7 @@ static int igt_gem_huge(void *arg) err =i915_gem_object_pin_pages_unlocked (obj);if (err) { -pr_err ("Failed to allocate %u pages (%lu total), err=%d\n" , +pr_err ("Failed to allocate %lu pages (%lu total), err=%d\n" , nreal, obj->base.size /PAGE_SIZE , err); goto out; }
@@ -57,7 +57,7 @@ static int igt_gem_huge(void *arg)for (n =0 ; n < obj->base.size /PAGE_SIZE ; n++) {if (i915_gem_object_get_page (obj, n) !=i915_gem_object_get_page (obj, n % nreal)) { -pr_err ("Page lookup mismatch at index %u [%u]\n" , +pr_err ("Page lookup mismatch at index %lu [%lu]\n" , n, n % nreal); err = -EINVAL ; goto out_unpin;
drivers/gpu/drm/i915/i915_gem.c +14 -4
@@ -229,8 +229,9 @@ i915_gem_shmem_pread(struct drm_i915_gem_object *obj, struct drm_i915_gem_pread *args) {unsigned int needs_clflush; -unsigned int idx, offset;char __user *user_data; +unsigned long offset; +pgoff_t idx;u64 remain;int ret;
@@ -383,13 +384,17 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj, {struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct i915_ggtt *ggtt =to_gt (i915)->ggtt; +unsigned long remain, offset;intel_wakeref_t wakeref;struct drm_mm_node node;void __user *user_data;struct i915_vma *vma; -u64 remain, offset;int ret =0 ; +if (overflows_type (args->size, remain) || +overflows_type (args->offset, offset)) +return -EINVAL ; + wakeref =intel_runtime_pm_get (&i915->runtime_pm); vma =i915_gem_gtt_prepare (obj, &node, false);
@@ -540,13 +545,17 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct i915_ggtt *ggtt =to_gt (i915)->ggtt;struct intel_runtime_pm *rpm = &i915->runtime_pm; +unsigned long remain, offset;intel_wakeref_t wakeref;struct drm_mm_node node;struct i915_vma *vma; -u64 remain, offset;void __user *user_data;int ret =0 ; +if (overflows_type (args->size, remain) || +overflows_type (args->offset, offset)) +return -EINVAL ; +if (i915_gem_object_has_struct_page (obj)) {/* * Avoid waking the device up if we can fallback, as
@@ -654,8 +663,9 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj, {unsigned int partial_cacheline_write;unsigned int needs_clflush; -unsigned int offset, idx;void __user *user_data; +unsigned long offset; +pgoff_t idx;u64 remain;int ret;
drivers/gpu/drm/i915/i915_vma.c +4 -4
@@ -936,7 +936,7 @@ rotate_pages(struct drm_i915_gem_object *obj, unsigned int offset, struct sg_table *st, struct scatterlist *sg) { unsigned int column, row; -unsigned int src_idx; +pgoff_t src_idx;for (column =0 ; column < width; column++) {unsigned int left;
@@ -1042,7 +1042,7 @@ add_padding_pages(unsigned int count,static struct scatterlist * remap_tiled_color_plane_pages(struct drm_i915_gem_object *obj, - unsigned int offset, unsigned int alignment_pad, + unsigned long offset, unsigned int alignment_pad, unsigned int width, unsigned int height, unsigned int src_stride, unsigned int dst_stride, struct sg_table *st, struct scatterlist *sg,
@@ -1101,7 +1101,7 @@ remap_tiled_color_plane_pages(struct drm_i915_gem_object *obj,static struct scatterlist *remap_contiguous_pages (struct drm_i915_gem_object *obj, -unsigned int obj_offset, +pgoff_t obj_offset,unsigned int count,struct sg_table *st,struct scatterlist *sg) {
@@ -1134,7 +1134,7 @@ remap_contiguous_pages(struct drm_i915_gem_object *obj,static struct scatterlist *remap_linear_color_plane_pages (struct drm_i915_gem_object *obj, -unsigned int obj_offset,unsigned int alignment_pad, +pgoff_t obj_offset,unsigned int alignment_pad,unsigned int size,struct sg_table *st,struct scatterlist *sg,unsigned int *gtt_offset)
Signature · 1 line
2.37.1
PATCH v16 2/6 drm/i915: Check for integer truncation on scatterlist creation
In reply to Gwan-gyeong MunFrom: Chris Wilson <[email protected]>
There is an impedance mismatch between the scatterlist API using unsigned int and our memory/page accounting in unsigned long. That is we may try to create a scatterlist for a large object that overflows returning a small table into which we try to fit very many pages. As the object size is under the control of userspace, we have to be prudent and catch the conversion errors.
To catch the implicit truncation we check before calling scattterlist creation Apis. we use overflows_type check and report E2BIG if the overflows may raise. When caller does not return errno, use WARN_ON to report a problem.
This is already used in our create ioctls to indicate if the uABI request is simply too large for the backing store. Failing that type check, we have a second check at sg_alloc_table time to make sure the values we are passing into the scatterlist API are not truncated.
v2: Move added i915_utils's macro into drm_util header (Jani N)
v5: Fix macros to be enclosed in parentheses for complex values
Fix too long line warning
v8: Replace safe_conversion() with check_assign() (Kees)
v14: Remove shadowing macros of scatterlist creation api and fix to
explicitly overflow check where the scatterlist creation APIs are called. (Jani)
v15: Add missing returning of error code when the WARN_ON() has been
detected. (Jani)
--- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 7 +++++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 --- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 4 ++++ drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 9 ++++++--- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 4 ++++ drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 6 +++++- drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c | 6 +++++- drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 8 ++++++++ drivers/gpu/drm/i915/gvt/dmabuf.c | 10 ++++++---- drivers/gpu/drm/i915/i915_scatterlist.c | 9 +++++++++ drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/selftests/scatterlist.c | 4 ++++ 12 files changed, 60 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_internal.c +5 -2
@@ -35,11 +35,15 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct sg_table *st;struct scatterlist *sg; -unsigned int npages; +unsigned int npages;/* restricted by sg_alloc_table */ int max_order =MAX_ORDER ;unsigned int max_segment;gfp_t gfp; +if (overflows_type (obj->base.size >>PAGE_SHIFT , npages)) +return -E2BIG ; + + npages = obj->base.size >>PAGE_SHIFT ; max_segment =i915_sg_segment_size (i915->drm.dev) >>PAGE_SHIFT ; max_order =min (max_order,get_order (max_segment));
@@ -55,7 +59,6 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)if (!st)return -ENOMEM ; - npages = obj->base.size /PAGE_SIZE ;if (sg_alloc_table (st, npages,GFP_KERNEL )) {kfree (st);return -ENOMEM ;
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -3
@@ -26,9 +26,6 @@ enum intel_region_id;* this and catch if we ever need to fix it. In the meantime, if you do * spot such a local variable, please consider fixing! * -* Aside from our own locals (for which we have no excuse!): -* - sg_table embeds unsigned int for nents -* * We can check for invalidly typed locals with typecheck(), see for example * i915_gem_object_get_sg(). */
drivers/gpu/drm/i915/gem/i915_gem_phys.c +4 -0
@@ -28,6 +28,10 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)void *dst;int i; +/* Contiguous chunk, with a single scatterlist element */ +if (overflows_type (obj->base.size, sg->length)) +return -E2BIG ; +if (GEM_WARN_ON (i915_gem_object_needs_bit17_swizzle (obj)))return -EINVAL ;
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +6 -3
@@ -60,7 +60,7 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st,struct address_space *mapping, unsigned int max_segment) { -const unsigned long page_count = size /PAGE_SIZE ; + unsigned int page_count; /* restricted by sg_alloc_table */unsigned long i;struct scatterlist *sg;struct page *page;
@@ -68,6 +68,10 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st,gfp_t noreclaim;int ret; +if (overflows_type (size /PAGE_SIZE , page_count)) +return -E2BIG ; + + page_count = size /PAGE_SIZE ;/* * If there's no chance of allocating enough pages for the whole * object, bail early.
@@ -193,7 +197,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct intel_memory_region *mem = obj->mm.region;struct address_space *mapping = obj->base.filp->f_mapping; -const unsigned long page_count = obj->base.size /PAGE_SIZE ;unsigned int max_segment =i915_sg_segment_size (i915->drm.dev);struct sg_table *st;struct sgt_iter sgt_iter;
@@ -236,7 +239,7 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) }else {dev_warn (i915->drm.dev,"Failed to DMA remap %lu pages\n" , - page_count); + obj->base.size >>PAGE_SHIFT ); goto err_pages; } }
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +4 -0
@@ -835,6 +835,10 @@ static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)struct ttm_place requested, busy[I915_TTM_MAX_PLACEMENTS ];struct ttm_placement placement; +/* restricted by sg_alloc_table */ + if (overflows_type(obj->base.size >> PAGE_SHIFT, unsigned int)) +return -E2BIG ; +GEM_BUG_ON (obj->mm.n_placements >I915_TTM_MAX_PLACEMENTS );/* Move to the requested placement. */
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +5 -1
@@ -128,12 +128,16 @@ static void i915_gem_object_userptr_drop_ref(struct drm_i915_gem_object *obj)static int i915_gem_userptr_get_pages (struct drm_i915_gem_object *obj) { -const unsigned long num_pages = obj->base.size >>PAGE_SHIFT ;unsigned int max_segment =i915_sg_segment_size (obj->base.dev->dev);struct sg_table *st;struct page **pvec; +unsigned int num_pages;/* limited by sg_alloc_table_from_pages_segment */ int ret; +if (overflows_type (obj->base.size >>PAGE_SHIFT , num_pages)) +return -E2BIG ; + + num_pages = obj->base.size >>PAGE_SHIFT ; st =kmalloc (sizeof (*st),GFP_KERNEL );if (!st)return -ENOMEM ;
drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c +5 -1
@@ -29,11 +29,15 @@ static int huge_get_pages(struct drm_i915_gem_object *obj) {#define GFP (GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL)const unsigned long nreal = obj->scratch /PAGE_SIZE ; -const unsigned long npages = obj->base.size /PAGE_SIZE ; +unsigned int npages;/* restricted by sg_alloc_table */ struct scatterlist *sg, *src, *end;struct sg_table *pages;unsigned long n; +if (overflows_type (obj->base.size /PAGE_SIZE , npages)) +return -E2BIG ; + + npages = obj->base.size /PAGE_SIZE ; pages =kmalloc (sizeof (*pages),GFP );if (!pages)return -ENOMEM ;
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +8 -0
@@ -84,6 +84,10 @@ static int get_huge_pages(struct drm_i915_gem_object *obj)unsigned int sg_page_sizes;u64 rem; +/* restricted by sg_alloc_table */ + if (overflows_type(obj->base.size >> PAGE_SHIFT, unsigned int)) +return -E2BIG ; + st =kmalloc (sizeof (*st),GFP );if (!st)return -ENOMEM ;
@@ -212,6 +216,10 @@ static int fake_get_huge_pages(struct drm_i915_gem_object *obj)struct scatterlist *sg;u64 rem; +/* restricted by sg_alloc_table */ + if (overflows_type(obj->base.size >> PAGE_SHIFT, unsigned int)) +return -E2BIG ; + st =kmalloc (sizeof (*st),GFP );if (!st)return -ENOMEM ;
drivers/gpu/drm/i915/gvt/dmabuf.c +6 -4
@@ -42,8 +42,7 @@#define GEN8_DECODE_PTE (pte) (pte & GENMASK_ULL(63, 12)) -static int vgpu_gem_get_pages ( -struct drm_i915_gem_object *obj) +static int vgpu_gem_get_pages (struct drm_i915_gem_object *obj) {struct drm_i915_private *dev_priv =to_i915 (obj->base.dev);struct intel_vgpu *vgpu;
@@ -52,8 +51,12 @@ static int vgpu_gem_get_pages(int i, j, ret;gen8_pte_t __iomem *gtt_entries;struct intel_vgpu_fb_info *fb_info; -u32 page_num; +unsigned int page_num;/* limited by sg_alloc_table */ +if (overflows_type (obj->base.size >>PAGE_SHIFT , page_num)) +return -E2BIG ; + + page_num = obj->base.size >>PAGE_SHIFT ; fb_info = (struct intel_vgpu_fb_info *)obj->gvt_info;if (drm_WARN_ON (&dev_priv->drm, !fb_info))return -ENODEV ;
@@ -66,7 +69,6 @@ static int vgpu_gem_get_pages(if (unlikely (!st))return -ENOMEM ; - page_num = obj->base.size >>PAGE_SHIFT ; ret =sg_alloc_table (st, page_num,GFP_KERNEL );if (ret) {kfree (st);
drivers/gpu/drm/i915/i915_scatterlist.c +9 -0
@@ -96,6 +96,11 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,i915_refct_sgt_init (rsgt, node->size <<PAGE_SHIFT ); st = &rsgt->table; +/* restricted by sg_alloc_table */ +if (WARN_ON (overflows_type (DIV_ROUND_UP_ULL (node->size, segment_pages), + unsigned int))) +return ERR_PTR (-E2BIG ); +if (sg_alloc_table (st,DIV_ROUND_UP_ULL (node->size, segment_pages),GFP_KERNEL )) {i915_refct_sgt_put (rsgt);
@@ -177,6 +182,10 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,i915_refct_sgt_init (rsgt, size); st = &rsgt->table; +/* restricted by sg_alloc_table */ + if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int))) +return ERR_PTR (-E2BIG ); +if (sg_alloc_table (st,PFN_UP (res->size),GFP_KERNEL )) {i915_refct_sgt_put (rsgt);return ERR_PTR (-ENOMEM );
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +4 -0
@@ -68,6 +68,10 @@ static int fake_get_pages(struct drm_i915_gem_object *obj)return -ENOMEM ; rem =round_up (obj->base.size,BIT (31 )) >>31 ; +/* restricted by sg_alloc_table */ + if (overflows_type(rem, unsigned int)) +return -E2BIG ; +if (sg_alloc_table (pages, rem,GFP )) {kfree (pages);return -ENOMEM ;
drivers/gpu/drm/i915/selftests/scatterlist.c +4 -0
@@ -220,6 +220,10 @@ static int alloc_table(struct pfn_table *pt,struct scatterlist *sg;unsigned long n, pfn; +/* restricted by sg_alloc_table */ + if (overflows_type(max, unsigned int)) +return -E2BIG ; +if (sg_alloc_table (&pt->st, max,GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN))return alloc_error;
Signature · 1 line
2.37.1
PATCH v16 3/6 drm/i915: Check for integer truncation on the configuration of ttm place
In reply to Gwan-gyeong MunThere is an impedance mismatch between the first/last valid page frame number of ttm place in unsigned and our memory/page accounting in unsigned long.
As the object size is under the control of userspace, we have to be prudent and catch the conversion errors.
To catch the implicit truncation as we switch from unsigned long to unsigned, we use overflows_type check and report E2BIG or overflow_type prior to the operation.
v3: Not to change execution inside a macro. (Mauro)
Add safe_conversion_gem_bug_on() macro and remove temporal SAFE_CONVERSION() macro.
v4: Fix unhandled GEM_BUG_ON() macro call from safe_conversion_gem_bug_on()
v6: Fix to follow general use case for GEM_BUG_ON(). (Jani)
v7: Fix to use WARN_ON() macro where GEM_BUG_ON() macro was used. (Jani)
v8: Replace safe_conversion() with check_assign() (Kees)
v14: Split one macro of assignment with checking of overflow to two steps,
first overflow check, and second assignment.
--- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 +++ drivers/gpu/drm/i915/intel_region_ttm.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +3 -0
@@ -140,13 +140,16 @@ i915_ttm_place_from_region(const struct intel_memory_region *mr,if (flags &I915_BO_ALLOC_CONTIGUOUS ) place->flags |=TTM_PL_FLAG_CONTIGUOUS ;if (offset !=I915_BO_INVALID_OFFSET ) { +WARN_ON (overflows_type (offset >>PAGE_SHIFT , place->fpfn)); place->fpfn = offset >>PAGE_SHIFT ; +WARN_ON (overflows_type (place->fpfn + (size >>PAGE_SHIFT ), place->lpfn)); place->lpfn = place->fpfn + (size >>PAGE_SHIFT ); }else if (mr->io_size && mr->io_size < mr->total) {if (flags &I915_BO_ALLOC_GPU_ONLY ) { place->flags |=TTM_PL_FLAG_TOPDOWN ; }else { place->fpfn =0 ; +WARN_ON (overflows_type (mr->io_size >>PAGE_SHIFT , place->lpfn)); place->lpfn = mr->io_size >>PAGE_SHIFT ; } }
drivers/gpu/drm/i915/intel_region_ttm.c +14 -0
@@ -208,13 +208,25 @@ intel_region_ttm_resource_alloc(struct intel_memory_region *mem,if (flags &I915_BO_ALLOC_CONTIGUOUS ) place.flags |=TTM_PL_FLAG_CONTIGUOUS ;if (offset !=I915_BO_INVALID_OFFSET ) { +if (WARN_ON (overflows_type (offset >>PAGE_SHIFT , place.fpfn))) { + ret = -E2BIG ; + goto out; + } place.fpfn = offset >>PAGE_SHIFT ; +if (WARN_ON (overflows_type (place.fpfn + (size >>PAGE_SHIFT ), place.lpfn))) { + ret = -E2BIG ; + goto out; + } place.lpfn = place.fpfn + (size >>PAGE_SHIFT ); }else if (mem->io_size && mem->io_size < mem->total) {if (flags &I915_BO_ALLOC_GPU_ONLY ) { place.flags |=TTM_PL_FLAG_TOPDOWN ; }else { place.fpfn =0 ; +if (WARN_ON (overflows_type (mem->io_size >>PAGE_SHIFT , place.lpfn))) { + ret = -E2BIG ; + goto out; + } place.lpfn = mem->io_size >>PAGE_SHIFT ; } }
@@ -223,6 +235,8 @@ intel_region_ttm_resource_alloc(struct intel_memory_region *mem, mock_bo.bdev = &mem->i915->bdev; ret = man->func->alloc (man, &mock_bo, &place, &res); + +out:if (ret == -ENOSPC ) ret = -ENXIO ;if (!ret)
Signature · 1 line
2.37.1
PATCH v16 4/6 drm/i915: Check if the size is too big while creating shmem file
In reply to Gwan-gyeong MunThe __shmem_file_setup() function returns -EINVAL if size is greater than MAX_LFS_FILESIZE. To handle the same error as other code that returns -E2BIG when the size is too large, it add a code that returns -E2BIG when the size is larger than the size that can be handled.
v4: If BITS_PER_LONG is 32, size > MAX_LFS_FILESIZE is always false, so it
checks only when BITS_PER_LONG is 64.
--- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +14 -0
@@ -541,6 +541,20 @@ static int __create_shmem(struct drm_i915_private *i915,drm_gem_private_object_init (&i915->drm, obj, size); +/* XXX: The __shmem_file_setup() function returns -EINVAL if size is +* greater than MAX_LFS_FILESIZE. +* To handle the same error as other code that returns -E2BIG when +* the size is too large, we add a code that returns -E2BIG when the +* size is larger than the size that can be handled. +* If BITS_PER_LONG is 32, size > MAX_LFS_FILESIZE is always false, +* so we only needs to check when BITS_PER_LONG is 64. +* If BITS_PER_LONG is 32, E2BIG checks are processed when +* i915_gem_object_size_2big() is called before init_object() callback +* is called. +*/ +if (BITS_PER_LONG ==64 && size >MAX_LFS_FILESIZE ) +return -E2BIG ; +if (i915->mm.gemfs) filp =shmem_file_setup_with_mnt (i915->mm.gemfs,"i915" , size, flags);
Signature · 1 line
2.37.1
PATCH v16 5/6 drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large
In reply to Gwan-gyeong MunThe ttm_bo_init_reserved() functions returns -ENOSPC if the size is too big to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range().
To handle the same error as other code returning -E2BIG when the size is too large, it converts return value to -E2BIG.
--- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +11 -0
@@ -1312,6 +1312,17 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem, ret =ttm_bo_init_reserved (&i915->bdev,i915_gem_to_ttm (obj), bo_type, &i915_sys_placement, page_size >>PAGE_SHIFT , &ctx,NULL ,NULL , i915_ttm_bo_destroy); + +/* +* XXX: The ttm_bo_init_reserved() functions returns -ENOSPC if the size +* is too big to add vma. The direct function that returns -ENOSPC is +* drm_mm_insert_node_in_range(). To handle the same error as other code +* that returns -E2BIG when the size is too large, it converts -ENOSPC to +* -E2BIG. +*/ +if (size >>PAGE_SHIFT >INT_MAX && ret == -ENOSPC ) + ret = -E2BIG ; +if (ret)return i915_ttm_err_to_gem (ret);
Signature · 1 line
2.37.1
PATCH v16 6/6 drm/i915: Remove truncation warning for large objects
In reply to Gwan-gyeong MunFrom: Chris Wilson <[email protected]>
Having addressed the issues surrounding incorrect types for local variables and potential integer truncation in using the scatterlist API, we have closed all the loop holes we had previously identified with dangerously large object creation. As such, we can eliminate the warning put in place to remind us to complete the review.
Cc: Tvrtko Ursulin <[email protected]>
Cc: Brian Welty <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: Thomas Hellström <[email protected]>
Testcase: igt@gem_create@create-massive
--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 15 --------------- 1 file changed, 15 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -15
@@ -20,25 +20,10 @@enum intel_region_id ; -/* -* XXX: There is a prevalence of the assumption that we fit the -* object's page count inside a 32bit _signed_ variable. Let's document -* this and catch if we ever need to fix it. In the meantime, if you do -* spot such a local variable, please consider fixing! -* -* We can check for invalidly typed locals with typecheck(), see for example -* i915_gem_object_get_sg(). -*/ -#define GEM_CHECK_SIZE_OVERFLOW (sz) \ - GEM_WARN_ON((sz) >> PAGE_SHIFT > INT_MAX) -static inline bool i915_gem_object_size_2big (u64 size) {struct drm_i915_gem_object *obj; -if (GEM_CHECK_SIZE_OVERFLOW (size)) -return true; -if (overflows_type (size, obj->base.size))return true;
Signature · 1 line
2.37.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
In reply to Gwan-gyeong Mun== Series Details ==
== Series Details ==
Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
URL : https://patchwork.freedesktop.org/series/112279/
State : warning
== Summary ==
Error: dim checkpatch failed580bc7c6ee10 drm/i915/gem: Typecheck page lookups
-:56: WARNING:DEPRECATED_API: Deprecated use of 'kmap_atomic', prefer 'kmap_local_page' instead #56: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.c:434:
+ src_map = kmap_atomic(i915_gem_object_get_page(obj, idx));
-:76: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #76: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.c:489:
+ GEM_BUG_ON(overflows_type(offset >> PAGE_SHIFT, pgoff_t));
-:150: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #150: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:413:
+#define i915_gem_object_page_iter_get_sg(obj, it, n, offset) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_page_iter_get_sg(obj, it, n, offset); \
+})
-:199: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #199: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:458:
+#define i915_gem_object_get_sg(obj, n, offset) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_sg(obj, n, offset); \
+})
-:248: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #248: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:503:
+#define i915_gem_object_get_sg_dma(obj, n, offset) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_sg_dma(obj, n, offset); \
+})
-:286: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #286: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:539:
+#define i915_gem_object_get_page(obj, n) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_page(obj, n); \
+})
-:323: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #323: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:574:
+#define i915_gem_object_get_dirty_page(obj, n) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_dirty_page(obj, n); \
+})
-:364: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #364: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:612:
+#define i915_gem_object_get_dma_address_len(obj, n, len) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_dma_address_len(obj, n, len); \
+})
-:401: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #401: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:647:
+#define i915_gem_object_get_dma_address(obj, n) ({ \
+ static_assert(castable_to_type(n, pgoff_t)); \
+ __i915_gem_object_get_dma_address(obj, n); \
+})
total: 0 errors, 2 warnings, 7 checks, 616 lines checked
383085856287 drm/i915: Check for integer truncation on scatterlist creation 60d38f11dfc7 drm/i915: Check for integer truncation on the configuration of ttm place c51e58da471c drm/i915: Check if the size is too big while creating shmem file 96ee63399a5e drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large 2402a45e5aac drm/i915: Remove truncation warning for large objects
Re: [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
Review
Quoted 13 lines · Patchwork
== Series Details ==
Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
URL : https://patchwork.freedesktop.org/series/112279/
State : warning== Summary ==
Error: dim checkpatch failed
580bc7c6ee10drm/i915/gem: Typecheck page lookups
-:56: WARNING:DEPRECATED_API: Deprecated use of 'kmap_atomic', prefer 'kmap_local_page' instead #56: FILE:drivers/gpu/drm/i915/gem/i915_gem_object.c:434:(quoted diff) +1
-0+ src_map = kmap_atomic(i915_gem_object_get_page(obj, idx));
The kmap_atomic() used in this patch series is not a new addition, but the input argument used in the existing kmap_atomic() call is replaced with a local variable. Therefore, I suggest the discussion of replacing kmap_atomic() with kmap_local_page() should be considered in a separate patch.
Unlike kmap_local_page(), kmap_atomic() is accompanied by additional operations (preempt_disable, pagefault_disable).
Therefore, it is necessary to separately review whether there is a side effect by changing kmap_atomic() to kmap_local_page().
(Note. In the current implementation on i915, only kmap_atomic() is used (used in 13 places) and kmap_local_page() is not used.)
[include/linux/highmem-internal.h]
static inline void *kmap_atomic(struct page *page)
{
if (IS_ENABLED(CONFIG_PREEMPT_RT))
migrate_disable();
else
preempt_disable();
pagefault_disable();
return page_address(page);
}
...
static inline void *kmap_local_page(struct page *page)
{
return page_address(page);
}Review
Quoted 4 lines
-:76: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use
WARN_ON_ONCE()plus recovery code (if feasible) instead ofBUG()or variants #76: FILE:drivers/gpu/drm/i915/gem/i915_gem_object.c:489:(quoted diff) +1
-0+ GEM_BUG_ON(overflows_type(offset >> PAGE_SHIFT, pgoff_t));
GEM_BUG_ON() used in this patch series is not a new addition, but the macro of the argument used for input has been changed from the previously used GEM_BUG_ON(). Changing GEM_BUG_ON() to a recoverable code should be considered in a separate patch.
Br,
G.G.
Quoted 58 lines
-:150: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #150: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:413:(quoted diff) +4
-1+#define i915_gem_object_page_iter_get_sg(obj, it, n, offset) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_page_iter_get_sg(obj, it, n, offset); \ +}) -:199: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#199: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:458:(quoted diff) +4
-1+#define i915_gem_object_get_sg(obj, n, offset) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_sg(obj, n, offset); \ +}) -:248: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#248: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:503:(quoted diff) +4
-1+#define i915_gem_object_get_sg_dma(obj, n, offset) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_sg_dma(obj, n, offset); \ +}) -:286: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#286: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:539:(quoted diff) +4
-1+#define i915_gem_object_get_page(obj, n) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_page(obj, n); \ +}) -:323: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#323: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:574:(quoted diff) +4
-1+#define i915_gem_object_get_dirty_page(obj, n) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_dirty_page(obj, n); \ +}) -:364: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#364: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:612:(quoted diff) +4
-1+#define i915_gem_object_get_dma_address_len(obj, n, len) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_dma_address_len(obj, n, len); \ +}) -:401: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?#401: FILE:
drivers/gpu/drm/i915/gem/i915_gem_object.h:647:(quoted diff) +4
-0+#define i915_gem_object_get_dma_address(obj, n) ({ \ + static_assert(castable_to_type(n, pgoff_t)); \ + __i915_gem_object_get_dma_address(obj, n); \ +})total: 0 errors, 2 warnings, 7 checks, 616 lines checked
383085856287 drm/i915: Check for integer truncation on scatterlist creation60d38f11dfc7drm/i915: Check for integer truncation on the configuration of ttm placec51e58da471cdrm/i915: Check if the size is too big while creating shmem file96ee63399a5edrm/i915: Use error code as-E2BIGwhen the size of gem ttm object is too large2402a45e5aacdrm/i915: Remove truncation warning for large objects
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
In reply to Gwan-gyeong Mun== Series Details ==
== Series Details ==
Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
URL : https://patchwork.freedesktop.org/series/112279/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
In reply to Gwan-gyeong Mun== Series Details ==
== Series Details ==
Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
URL : https://patchwork.freedesktop.org/series/112279/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12528 -> Patchwork_112279v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/index.html
Participating hosts (40 -> 44)
------------------------------
Additional (4): fi-kbl-soraka fi-bsw-kefka bat-dg2-9 bat-atsm-1
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_112279v1:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@runner@aborted:
- {bat-adlp-9}: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-9/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_112279v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_gttfill@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][2] ([fdo#109271]) +7 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@parallel-random-engines:
- bat-adlp-4: NOTRUN -> [SKIP][5] ([i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
* igt@i915_pm_rps@basic-api:
- bat-adlp-4: NOTRUN -> [SKIP][6] ([i915#6621])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][7] ([i915#1886])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@late_gt_pm:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][8] ([i915#7640])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@i915_selftest@live@late_gt_pm.html
* igt@i915_selftest@live@migrate:
- bat-adlp-4: NOTRUN -> [DMESG-FAIL][9] ([i915#7699])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@i915_selftest@[email protected]
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-hsw-4770: NOTRUN -> [SKIP][10] ([fdo#109271] / [fdo#111827])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-hsw-4770/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][11] ([fdo#111827])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-bsw-kefka: NOTRUN -> [SKIP][12] ([fdo#109271] / [fdo#111827]) +8 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-bsw-kefka/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827]) +7 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-kbl-soraka/igt@[email protected]
* igt@kms_setmode@basic-clone-single-crtc:
- fi-snb-2600: NOTRUN -> [SKIP][14] ([fdo#109271])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-snb-2600/igt@[email protected]
* igt@prime_vgem@basic-fence-flip:
- fi-bsw-kefka: NOTRUN -> [SKIP][15] ([fdo#109271]) +17 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-bsw-kefka/igt@[email protected]
* igt@prime_vgem@basic-userptr:
- bat-adlp-4: NOTRUN -> [SKIP][16] ([fdo#109295] / [i915#3301] / [i915#3708])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
* igt@prime_vgem@basic-write:
- bat-adlp-4: NOTRUN -> [SKIP][17] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
#### Possible fixes ####
* igt@i915_pm_rpm@basic-rte:
- bat-adlp-4: [DMESG-WARN][18] ([i915#7077]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/bat-adlp-4/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-adlp-4/igt@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-cfl-8109u: [DMESG-FAIL][20] ([i915#5334]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [INCOMPLETE][22] ([i915#4785]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/fi-hsw-4770/igt@i915_selftest@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/fi-hsw-4770/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@reset:
- {bat-rpls-2}: [DMESG-FAIL][24] ([i915#4983]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/bat-rpls-2/igt@i915_selftest@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/bat-rpls-2/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1836]: https://gitlab.freedesktop.org/drm/intel/issues/1836
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6077]: https://gitlab.freedesktop.org/drm/intel/issues/6077
[i915#6078]: https://gitlab.freedesktop.org/drm/intel/issues/6078
[i915#6093]: https://gitlab.freedesktop.org/drm/intel/issues/6093
[i915#6094]: https://gitlab.freedesktop.org/drm/intel/issues/6094
[i915#6166]: https://gitlab.freedesktop.org/drm/intel/issues/6166
[i915#6311]: https://gitlab.freedesktop.org/drm/intel/issues/6311
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7077]: https://gitlab.freedesktop.org/drm/intel/issues/7077
[i915#7357]: https://gitlab.freedesktop.org/drm/intel/issues/7357
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7640]: https://gitlab.freedesktop.org/drm/intel/issues/7640
[i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
Build changes
-------------
* Linux: CI_DRM_12528 -> Patchwork_112279v1
CI-20190529: 20190529
CI_DRM_12528: 7e9f060b6f2ad746710306da06ba9c4a53876357 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7104: fe5def13049225967770eaaf19ec01ef80e2adc5 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_112279v1: 7e9f060b6f2ad746710306da06ba9c4a53876357 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
ad580bfb2c81 drm/i915: Remove truncation warning for large objects ab0b994e08dc drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large 5bcbc61d97b3 drm/i915: Check if the size is too big while creating shmem file 5ef5f4c7cd8a drm/i915: Check for integer truncation on the configuration of ttm place f63af31128b5 drm/i915: Check for integer truncation on scatterlist creation f451d70d6c05 drm/i915/gem: Typecheck page lookups
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/index.html
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
In reply to Gwan-gyeong Mun== Series Details ==
== Series Details ==
Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation
URL : https://patchwork.freedesktop.org/series/112279/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12528_full -> Patchwork_112279v1_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/index.html
Participating hosts (13 -> 10)
------------------------------
Missing (3): pig-skl-6260u pig-kbl-iris pig-glk-j5005
Known issues
------------
Here are the changes found in Patchwork_112279v1_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [PASS][1] -> [FAIL][2] ([i915#2842])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk3/igt@gem_exec_fair@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk3/igt@gem_exec_fair@[email protected]
* igt@gen9_exec_parse@allowed-single:
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([i915#5566] / [i915#716])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk2/igt@[email protected]
* igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#3886])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk5/igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_chamelium@dp-edid-stress-resolution-non-4k:
- shard-glk: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk8/igt@[email protected]
* igt@kms_psr2_su@frontbuffer-xrgb8888:
- shard-glk: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#658]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk8/igt@[email protected]
* igt@kms_vrr@negative-basic:
- shard-glk: NOTRUN -> [SKIP][8] ([fdo#109271]) +54 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk8/igt@[email protected]
* igt@sysfs_clients@recycle-many:
- shard-glk: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#2994])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk8/igt@[email protected]
#### Possible fixes ####
* igt@fbdev@unaligned-write:
- {shard-rkl}: [SKIP][10] ([i915#2582]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@gem_create@create-massive:
- {shard-rkl}: [DMESG-WARN][12] ([i915#4991]) -> [PASS][13] +1 similar issue
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
- {shard-dg1}: [DMESG-WARN][14] ([i915#4991]) -> [PASS][15] +1 similar issue
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-dg1-15/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-dg1-15/igt@[email protected]
- shard-glk: [DMESG-WARN][16] ([i915#4991]) -> [PASS][17] +1 similar issue
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk6/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk8/igt@[email protected]
* igt@gem_ctx_exec@basic-nohangcheck:
- {shard-tglu-10}: [FAIL][18] ([i915#6268]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-tglu-10/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-tglu-10/igt@[email protected]
* igt@gem_exec_endless@dispatch@bcs0:
- {shard-rkl}: [SKIP][20] ([i915#6247]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-5/igt@gem_exec_endless@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-4/igt@gem_exec_endless@[email protected]
* igt@gem_exec_fair@basic-pace@rcs0:
- {shard-rkl}: [FAIL][22] ([i915#2842]) -> [PASS][23] +2 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-4/igt@gem_exec_fair@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-5/igt@gem_exec_fair@[email protected]
* igt@gem_exec_reloc@basic-cpu-read-noreloc:
- {shard-rkl}: [SKIP][24] ([i915#3281]) -> [PASS][25] +3 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-4/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-5/igt@[email protected]
* igt@gem_partial_pwrite_pread@writes-after-reads-uncached:
- {shard-rkl}: [SKIP][26] ([i915#3282]) -> [PASS][27] +3 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-4/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-5/igt@[email protected]
* igt@gem_workarounds@suspend-resume:
- {shard-rkl}: [FAIL][28] ([fdo#103375]) -> [PASS][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-3/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@gen9_exec_parse@allowed-all:
- {shard-rkl}: [SKIP][30] ([i915#2527]) -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-3/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-5/igt@[email protected]
* igt@i915_pm_dc@dc5-psr:
- {shard-rkl}: [SKIP][32] ([i915#658]) -> [PASS][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@i915_pm_dc@dc9-dpms:
- {shard-rkl}: [SKIP][34] ([i915#3361]) -> [PASS][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-5/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-4/igt@[email protected]
* igt@i915_pm_rpm@cursor-dpms:
- {shard-rkl}: [SKIP][36] ([i915#1849]) -> [PASS][37] +1 similar issue
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- {shard-dg1}: [SKIP][38] ([i915#1397]) -> [PASS][39] +2 similar issues
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-dg1-16/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-dg1-14/igt@[email protected]
* igt@kms_big_fb@x-tiled-32bpp-rotate-0:
- {shard-rkl}: [SKIP][40] ([i915#1845] / [i915#4098]) -> [PASS][41] +17 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@kms_flip@2x-flip-vs-expired-vblank@ab-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][42] ([i915#2122]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk3/igt@kms_flip@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk9/igt@kms_flip@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@b-hdmi-a2:
- shard-glk: [FAIL][44] ([i915#79]) -> [PASS][45] +1 similar issue
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk3/igt@kms_flip@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk3/igt@kms_flip@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- {shard-rkl}: [SKIP][46] ([i915#1849] / [i915#4098]) -> [PASS][47] +17 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
* igt@kms_plane@plane-panning-bottom-right@pipe-a-planes:
- {shard-rkl}: [SKIP][48] ([i915#3558]) -> [PASS][49] +1 similar issue
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@kms_plane@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@kms_plane@[email protected]
* igt@kms_psr@cursor_mmap_gtt:
- {shard-rkl}: [SKIP][50] ([i915#1072]) -> [PASS][51] +2 similar issues
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@kms_psr@cursor_mmap_gtt.html
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@kms_psr@cursor_mmap_gtt.html
* igt@kms_universal_plane@cursor-fb-leak-pipe-b:
- {shard-rkl}: [SKIP][52] ([i915#1845] / [i915#4070] / [i915#4098]) -> [PASS][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
* igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-b:
- {shard-rkl}: [SKIP][54] ([i915#4070] / [i915#4098]) -> [PASS][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-1/igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-b.html
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-b.html
* igt@perf@mi-rpc:
- {shard-rkl}: [SKIP][56] ([i915#2434]) -> [PASS][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-3/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-5/igt@[email protected]
* igt@perf@polling-small-buf:
- {shard-rkl}: [FAIL][58] ([i915#1722]) -> [PASS][59]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-rkl-3/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-rkl-6/igt@[email protected]
#### Warnings ####
* igt@runner@aborted:
- shard-glk: ([FAIL][60], [FAIL][61]) ([i915#3002] / [i915#4312]) -> [FAIL][62] ([i915#4312])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk5/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12528/shard-glk6/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/shard-glk2/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109307]: https://bugs.freedesktop.org/show_bug.cgi?id=109307
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
[i915#1769]: https://gitlab.freedesktop.org/drm/intel/issues/1769
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1850]: https://gitlab.freedesktop.org/drm/intel/issues/1850
[i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2436]: https://gitlab.freedesktop.org/drm/intel/issues/2436
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3810]: https://gitlab.freedesktop.org/drm/intel/issues/3810
[i915#3825]: https://gitlab.freedesktop.org/drm/intel/issues/3825
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#3966]: https://gitlab.freedesktop.org/drm/intel/issues/3966
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4991]: https://gitlab.freedesktop.org/drm/intel/issues/4991
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5327]: https://gitlab.freedesktop.org/drm/intel/issues/5327
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#7037]: https://gitlab.freedesktop.org/drm/intel/issues/7037
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#716]: https://gitlab.freedesktop.org/drm/intel/issues/716
[i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
Build changes
-------------
* Linux: CI_DRM_12528 -> Patchwork_112279v1
* Piglit: piglit_4509 -> None
CI-20190529: 20190529
CI_DRM_12528: 7e9f060b6f2ad746710306da06ba9c4a53876357 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7104: fe5def13049225967770eaaf19ec01ef80e2adc5 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_112279v1: 7e9f060b6f2ad746710306da06ba9c4a53876357 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112279v1/index.html
Rodrigo Vivi
maintainerQuoted 21 lines · Gwan-gyeong Mun
This patch series fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation, etc. We need to check that we avoid integer overflows when looking up a page, and so fix all the instances where we have mistakenly used a plain integer instead of a more suitable long.
And there is an impedance mismatch between the scatterlist API using unsigned int and our memory/page accounting in unsigned long. That is we may try to create a scatterlist for a large object that overflows returning a small table into which we try to fit very many pages. As the object size is under the control of userspace, we have to be prudent and catch the conversion errors. To catch the implicit truncation as we switch from unsigned long into the scatterlist's unsigned int, we use improvedoverflows_typecheck and report E2BIG prior to the operation. This is already used in our create ioctls to indicate if the uABI request is simply too large for the backing store.
And ttm place also has the same problem with scatterlist creation, and we fix the integer truncation problem with the way approached by scatterlist creation.
And It corrects the error code to return-E2BIGwhen creating gem objects using ttm or shmem, if the size is too large in each case.
Quoted 7 lines
Compared to the v15 version patch series[1], there is no code modification in this version patch series. Among the warnings reported by CI.CHECKPATCH, this patch fixes the parts that need fixing.
Fix "ERROR:SPACING" Checkpatch report
Fix "WARNING:COMMIT_LOG_LONG_LINE" Checkpatch report
I have backmerged the drm-next to drm-intel-gt-next and pushed this series. Thanks for the patches and reviews.
Quoted 38 lines
Chris Wilson (3):
drm/i915/gem: Typecheck page lookups
drm/i915: Check for integer truncation on scatterlist creation drm/i915: Remove truncation warning for large objectsGwan-gyeong Mun (3):
drm/i915: Check for integer truncation on the configuration of ttm
place
drm/i915: Check if the size is too big while creating shmem file drm/i915: Use error code as-E2BIGwhen the size of gem ttm object is
too largedrivers/gpu/drm/i915/gem/i915_gem_internal.c | 7 +- drivers/gpu/drm/i915/gem/i915_gem_object.c | 7 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 303 +++++++++++++++--- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 27 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 4 + drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 23 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 20 +- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 6 +- .../drm/i915/gem/selftests/huge_gem_object.c | 6 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 8 + .../drm/i915/gem/selftests/i915_gem_context.c | 12 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 8 +- .../drm/i915/gem/selftests/i915_gem_object.c | 8 +- drivers/gpu/drm/i915/gvt/dmabuf.c | 10 +- drivers/gpu/drm/i915/i915_gem.c | 18 +- drivers/gpu/drm/i915/i915_scatterlist.c | 9 + drivers/gpu/drm/i915/i915_vma.c | 8 +- drivers/gpu/drm/i915/intel_region_ttm.c | 14 + drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 + drivers/gpu/drm/i915/selftests/scatterlist.c | 4 + 20 files changed, 420 insertions(+), 86 deletions(-)Signature · 1 line
2.37.1