mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Jia-Ju Bai" <baijiaju1990@gmail.com>,
	airlied@linux.ie, gustavo@padovan.org,
	maarten.lankhorst@linux.intel.com, seanpaul@chromium.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexdeucher@gmail.com>,
	amd-gfx@lists.freedesktop.org, "David Zhou" <David1.Zhou@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] gpu: drm: drm_mm: Fix a sleep-in-atomic-context bug in show_leaks()
Date: Mon, 3 Sep 2018 09:52:44 +0200	[thread overview]
Message-ID: <20180903075244.GE21634@phenom.ffwll.local> (raw)
In-Reply-To: <153580517420.12034.2035309606925619207@skylake-alporthouse-com>

On Sat, Sep 01, 2018 at 01:32:54PM +0100, Chris Wilson wrote:
> Quoting Jia-Ju Bai (2018-09-01 13:20:41)
> > The driver may sleep with holding a spinlock.
> > 
> > The function call paths (from bottom to top) in Linux-4.16 are:
> > 
> > [FUNC] kmalloc(GFP_KERNEL)
> > drivers/gpu/drm/drm_mm.c, 130: 
> >         kmalloc in show_leaks
> > drivers/gpu/drm/drm_mm.c, 913: 
> >         show_leaks in drm_mm_takedown
> > drivers/gpu/drm/drm_vma_manager.c, 107: 
> >         drm_mm_takedown in drm_vma_offset_manager_destroy
> > drivers/gpu/drm/drm_vma_manager.c, 106: 
> >         _raw_write_lock in drm_vma_offset_manager_destroy
> > 
> > [FUNC] kmalloc(GFP_KERNEL)
> > drivers/gpu/drm/drm_mm.c, 130: 
> >         kmalloc in show_leaks
> > drivers/gpu/drm/drm_mm.c, 913: 
> >         show_leaks in drm_mm_takedown
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c, 71: 
> >         drm_mm_takedown in amdgpu_vram_mgr_fini
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c, 70: 
> >         spin_lock in amdgpu_vram_mgr_fini
> > 
> > [FUNC] kmalloc(GFP_KERNEL)
> > drivers/gpu/drm/drm_mm.c, 130: 
> >         kmalloc in show_leaks
> > drivers/gpu/drm/drm_mm.c, 913: 
> >         show_leaks in drm_mm_takedown
> > drivers/gpu/drm/ttm/ttm_bo_manager.c, 128: 
> >         drm_mm_takedown in ttm_bo_man_takedown
> > drivers/gpu/drm/ttm/ttm_bo_manager.c, 126: 
> >         spin_lock in ttm_bo_man_takedown
> > 
> > To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
> 
> The bug are above, since those spinlocks do not protect the data and
> imply use-after-free.

Adding amdgpu, since that's where the bug seems to be.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2018-09-03  7:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01 12:20 Jia-Ju Bai
2018-09-01 12:32 ` Chris Wilson
2018-09-03  7:52   ` Daniel Vetter [this message]
2018-09-03 12:05     ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180903075244.GE21634@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=David1.Zhou@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=baijiaju1990@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome