intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region
@ 2021-08-18 17:12 Matthew Auld
  2021-08-18 19:07 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
  2021-08-19  7:25 ` [Intel-gfx] [PATCH] " Thomas Hellström
  0 siblings, 2 replies; 4+ messages in thread
From: Matthew Auld @ 2021-08-18 17:12 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel, Thomas Hellström

If the ttm_bo_init_reserved() call fails ensure we also release the
region, otherwise we leak the reference, or worse hit some uaf, when we
start using the objects.list. Also remove the make_unshrinkable call
here, which doesn't do anything.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 771eb2963123..2e8cdcd5e4f7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -909,7 +909,6 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 	drm_gem_private_object_init(&i915->drm, &obj->base, size);
 	i915_gem_object_init(obj, &i915_gem_ttm_obj_ops, &lock_class, flags);
 	i915_gem_object_init_memory_region(obj, mem);
-	i915_gem_object_make_unshrinkable(obj);
 	INIT_RADIX_TREE(&obj->ttm.get_io_page.radix, GFP_KERNEL | __GFP_NOWARN);
 	mutex_init(&obj->ttm.get_io_page.lock);
 	bo_type = (obj->flags & I915_BO_ALLOC_USER) ? ttm_bo_type_device :
@@ -932,7 +931,7 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 				   page_size >> PAGE_SHIFT,
 				   &ctx, NULL, NULL, i915_ttm_bo_destroy);
 	if (ret)
-		return i915_ttm_err_to_gem(ret);
+		goto err_release_mr;
 
 	obj->ttm.created = true;
 	i915_ttm_adjust_domains_after_move(obj);
@@ -940,6 +939,10 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 	i915_gem_object_unlock(obj);
 
 	return 0;
+
+err_release_mr:
+	i915_gem_object_release_memory_region(obj);
+	return i915_ttm_err_to_gem(ret);
 }
 
 static const struct intel_memory_region_ops ttm_system_region_ops = {
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/ttm: ensure we release the intel_memory_region
  2021-08-18 17:12 [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region Matthew Auld
@ 2021-08-18 19:07 ` Patchwork
  2021-08-19  7:25 ` [Intel-gfx] [PATCH] " Thomas Hellström
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2021-08-18 19:07 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 5257 bytes --]

== Series Details ==

Series: drm/i915/ttm: ensure we release the intel_memory_region
URL   : https://patchwork.freedesktop.org/series/93791/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10496 -> Patchwork_20848
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_20848 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_20848, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/index.html

Possible new issues
-------------------

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_pm_rpm@module-reload:
    - fi-tgl-1115g4:      NOTRUN -> [INCOMPLETE][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@i915_pm_rpm@module-reload.html

  * igt@kms_addfb_basic@too-wide:
    - fi-tgl-1115g4:      NOTRUN -> [DMESG-WARN][2] +89 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@kms_addfb_basic@too-wide.html

  
Known issues
------------

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

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_cs_nop@sync-fork-compute0:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][3] ([fdo#109271]) +8 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-kbl-soraka/igt@amdgpu/amd_cs_nop@sync-fork-compute0.html

  * igt@core_hotunplug@unbind-rebind:
    - fi-tgl-1115g4:      NOTRUN -> [DMESG-WARN][4] ([i915#1982])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@core_hotunplug@unbind-rebind.html

  * igt@gem_huc_copy@huc-copy:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][5] ([i915#2190])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@gem_huc_copy@huc-copy.html

  * igt@i915_pm_backlight@basic-brightness:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][6] ([i915#1155])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@i915_pm_backlight@basic-brightness.html

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][7] ([fdo#111827]) +8 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@kms_chamelium@common-hpd-after-suspend.html

  * igt@kms_force_connector_basic@force-load-detect:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][8] ([fdo#109285])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_psr@primary_mmap_gtt:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][9] ([i915#1072]) +3 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html

  * igt@prime_vgem@basic-userptr:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][10] ([i915#3301])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@prime_vgem@basic-userptr.html

  * igt@runner@aborted:
    - fi-bdw-5557u:       NOTRUN -> [FAIL][11] ([i915#1602] / [i915#2029])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-bdw-5557u/igt@runner@aborted.html
    - fi-tgl-1115g4:      NOTRUN -> [FAIL][12] ([i915#2722] / [i915#3834])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/fi-tgl-1115g4/igt@runner@aborted.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
  [i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
  [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
  [i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
  [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
  [i915#3834]: https://gitlab.freedesktop.org/drm/intel/issues/3834


Participating hosts (34 -> 34)
------------------------------

  Additional (1): fi-tgl-1115g4 
  Missing    (1): fi-bsw-cyan 


Build changes
-------------

  * Linux: CI_DRM_10496 -> Patchwork_20848

  CI-20190529: 20190529
  CI_DRM_10496: e4f0d7fe9eeff06828925fc08a58a0084a205e50 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6178: 146260200f9a6d4536e48a195e2ab49a07d4f0c1 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_20848: fa8be4d952ec47c853afa2d424d137abe8584d5e @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

fa8be4d952ec drm/i915/ttm: ensure we release the intel_memory_region

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20848/index.html

[-- Attachment #2: Type: text/html, Size: 6174 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region
  2021-08-18 17:12 [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region Matthew Auld
  2021-08-18 19:07 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2021-08-19  7:25 ` Thomas Hellström
  2021-08-19  8:29   ` Matthew Auld
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Hellström @ 2021-08-19  7:25 UTC (permalink / raw)
  To: Matthew Auld, intel-gfx; +Cc: dri-devel

On Wed, 2021-08-18 at 18:12 +0100, Matthew Auld wrote:
> If the ttm_bo_init_reserved() call fails ensure we also release the
> region, otherwise we leak the reference, or worse hit some uaf, when
> we
> start using the objects.list. Also remove the make_unshrinkable call
> here, which doesn't do anything.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> index 771eb2963123..2e8cdcd5e4f7 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> @@ -909,7 +909,6 @@ int __i915_gem_ttm_object_init(struct
> intel_memory_region *mem,
>         drm_gem_private_object_init(&i915->drm, &obj->base, size);
>         i915_gem_object_init(obj, &i915_gem_ttm_obj_ops, &lock_class,
> flags);
>         i915_gem_object_init_memory_region(obj, mem);
> -       i915_gem_object_make_unshrinkable(obj);
>         INIT_RADIX_TREE(&obj->ttm.get_io_page.radix, GFP_KERNEL |
> __GFP_NOWARN);
>         mutex_init(&obj->ttm.get_io_page.lock);
>         bo_type = (obj->flags & I915_BO_ALLOC_USER) ?
> ttm_bo_type_device :
> @@ -932,7 +931,7 @@ int __i915_gem_ttm_object_init(struct
> intel_memory_region *mem,
>                                    page_size >> PAGE_SHIFT,
>                                    &ctx, NULL, NULL,
> i915_ttm_bo_destroy);
>         if (ret)
> -               return i915_ttm_err_to_gem(ret);
> +               goto err_release_mr;

IIRC when ttm_object_init_reserved fails, it will call ttm_bo_put()
which will eventually end up in i915_ttm_bo_destroy() which will do the
right thing?

/Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region
  2021-08-19  7:25 ` [Intel-gfx] [PATCH] " Thomas Hellström
@ 2021-08-19  8:29   ` Matthew Auld
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Auld @ 2021-08-19  8:29 UTC (permalink / raw)
  To: Thomas Hellström
  Cc: Matthew Auld, Intel Graphics Development, ML dri-devel

On Thu, 19 Aug 2021 at 08:25, Thomas Hellström
<thomas.hellstrom@linux.intel.com> wrote:
>
> On Wed, 2021-08-18 at 18:12 +0100, Matthew Auld wrote:
> > If the ttm_bo_init_reserved() call fails ensure we also release the
> > region, otherwise we leak the reference, or worse hit some uaf, when
> > we
> > start using the objects.list. Also remove the make_unshrinkable call
> > here, which doesn't do anything.
> >
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> > Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> > b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> > index 771eb2963123..2e8cdcd5e4f7 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> > @@ -909,7 +909,6 @@ int __i915_gem_ttm_object_init(struct
> > intel_memory_region *mem,
> >         drm_gem_private_object_init(&i915->drm, &obj->base, size);
> >         i915_gem_object_init(obj, &i915_gem_ttm_obj_ops, &lock_class,
> > flags);
> >         i915_gem_object_init_memory_region(obj, mem);
> > -       i915_gem_object_make_unshrinkable(obj);
> >         INIT_RADIX_TREE(&obj->ttm.get_io_page.radix, GFP_KERNEL |
> > __GFP_NOWARN);
> >         mutex_init(&obj->ttm.get_io_page.lock);
> >         bo_type = (obj->flags & I915_BO_ALLOC_USER) ?
> > ttm_bo_type_device :
> > @@ -932,7 +931,7 @@ int __i915_gem_ttm_object_init(struct
> > intel_memory_region *mem,
> >                                    page_size >> PAGE_SHIFT,
> >                                    &ctx, NULL, NULL,
> > i915_ttm_bo_destroy);
> >         if (ret)
> > -               return i915_ttm_err_to_gem(ret);
> > +               goto err_release_mr;
>
> IIRC when ttm_object_init_reserved fails, it will call ttm_bo_put()
> which will eventually end up in i915_ttm_bo_destroy() which will do the
> right thing?

Ah right, missed that.

>
> /Thomas
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-19  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 17:12 [Intel-gfx] [PATCH] drm/i915/ttm: ensure we release the intel_memory_region Matthew Auld
2021-08-18 19:07 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2021-08-19  7:25 ` [Intel-gfx] [PATCH] " Thomas Hellström
2021-08-19  8:29   ` Matthew Auld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).