intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: FNU VISHWANATHA <fnu.vishwanatha@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Kornel Dulęba" <korneld@google.com>
Subject: Re: [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic
Date: Thu, 15 Oct 2026 06:51:07 -0700	[thread overview]
Message-ID: <atDaS9XDmNGa63JR@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20261006175741.3582911-1-fnu.vishwanatha@intel.com>

On Tue, Oct 06, 2026 at 10:57:40AM -0700, FNU VISHWANATHA wrote:
> From: Kornel Dulęba <korneld@google.com>
> 
> A kernel panic caused by a list corruption was observed when the IPU6
> driver is running under heavy load. The panic would reproduce
> consistently within a few minutes of the test suite running, though
> never during the same test. The corruption would always happen in
> list_add_tail called from xe_bo_pin_external:
> 
> list_add corruption. prev->next should be next (ffff8bb9862912c8), but was ffff8bb9e811e2a8. (prev=ffff8bb9e811e2a8)
> 
> Having prev->next == prev, suggests that node was re-initialized without
> being removed from the list first. This indicates that the BO might have
> been destroyed while it was still pinned.

This is a bug if true.

> Looking into xe_ttm_bo_destroy and its caller ttm_bo_release, reveals
> that the latter supports a case where bo->pin_count > 0, albeit with a
> WARN_ON_ONCE. Since ttm_bo_release sets bo->pin_count to 0 in that case,
> add a complementary change to also remove bo->pinned_link from the list.
> With this applied, the test progresses much further, with the newly
> added warning seen in dmesg.
> 
> Test: atest CtsCameraTestCases
>

I don't doubt the test case but this an investigation for a proper fix.
 
> Signed-off-by: Kornel Dulęba <korneld@google.com>
> ---
>  drivers/gpu/drm/xe/xe_bo.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index f2634d048cd4..c5989db950f7 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -1688,6 +1688,11 @@ static void xe_ttm_bo_destroy(struct ttm_buffer_object *ttm_bo)
>  	if (bo->parent_obj)
>  		xe_bo_put(bo->parent_obj);
>  
> +	spin_lock(&xe->pinned.lock);
> +	if (WARN_ON_ONCE(!list_empty(&bo->pinned_link)))
> +		list_del_init(&bo->pinned_link);
> +	spin_unlock(&xe->pinned.lock);
> +

It shouldn't be possible to get here with a BO on the pinned list, so
this is papering over a bug some where else in the driver.

I'd prefer 'xe_assert(xe, !list_empty(&bo->pinned_link));' be added to
the code to assert this and if this pops, we case down the root cause.

Can you please file a gitlab issue with the details of this failure so
we assist debugging and get a proper fix?

Matt

>  	mutex_lock(&xe->mem_access.vram_userfault.lock);
>  	if (!list_empty(&bo->vram_userfault_link))
>  		list_del(&bo->vram_userfault_link);
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2026-10-15 13:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 17:57 [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic FNU VISHWANATHA
2026-10-06 17:57 ` [PATCH 2/2] RFC: drm/xe: Prevent pinned_link double add FNU VISHWANATHA
2026-10-06 18:16   ` sashiko-bot
2026-10-15 13:53   ` Matthew Brost
2026-10-06 18:15 ` [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic sashiko-bot
2026-10-06 18:37 ` ✗ CI.checkpatch: warning for series starting with [1/2] " Patchwork
2026-10-06 18:39 ` ✓ CI.KUnit: success " Patchwork
2026-10-06 19:38 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-07  1:17 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-13 22:06 ` ✗ CI.checkpatch: warning for series starting with [1/2] RFC: drm/xe: Fix pinned list UAF panic (rev2) Patchwork
2026-10-13 22:08 ` ✓ CI.KUnit: success " Patchwork
2026-10-14  3:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-14 14:50 ` ✓ Xe.CI.FULL: " Patchwork
2026-10-15 13:51 ` Matthew Brost [this message]
2026-10-15 13:54   ` [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic Matthew Brost

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=atDaS9XDmNGa63JR@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fnu.vishwanatha@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=korneld@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).