From: Matthew Brost <matthew.brost@intel.com>
To: Zongyao Bai <zongyao.bai@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Matthew Auld <matthew.auld@intel.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] drm/xe/pt: Reset current_op in xe_pt_update_ops_init()
Date: Tue, 14 Jul 2026 18:46:16 -0700 [thread overview]
Message-ID: <albmaGCoA32iIsvt@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260714232433.2737533-1-zongyao.bai@intel.com>
On Tue, Jul 14, 2026 at 11:24:32PM +0000, Zongyao Bai wrote:
> xe_pt_update_ops_init() fails to reset current_op to 0. On the
> vm_bind path, ops_execute() calls xe_pt_update_ops_prepare() inside
> the xe_validation_guard() / drm_exec_until_all_locked() loop. When
> that loop retries due to lock contention or OOM eviction
> (drm_exec_retry_on_contention() / xe_validation_retry_on_oom()),
> xe_pt_update_ops_prepare() runs again on the same vops, and each
> call to bind_op_prepare() increments current_op without resetting it.
>
> After N retries current_op exceeds the array size allocated by
> xe_vma_ops_alloc(), causing an out-of-bounds write into
> SLUB-poisoned memory and a subsequent UAF crash in
> xe_migrate_update_pgtables_cpu() when reading the corrupted pt_op->bind.
>
> Also reset needs_svm_lock and needs_invalidation which are derived in
> the same prepare pass and would otherwise cause wrong migrate ops
> selection and redundant TLB invalidation on retry.
>
> Fix this by resetting current_op, needs_svm_lock and needs_invalidation
> in xe_pt_update_ops_init().
>
> v2 (Matt):
> - Add details in commit message.
> - Add Fixes tag and Cc to stable@vger.kernel.org
>
> Fixes: e8babb280b5e ("drm/xe: Convert multiple bind ops into single job")
> Suggested-by: Matthew Auld <matthew.auld@intel.com>
> Cc: stable@vger.kernel.org
> Assisted-by: GitHub-Copilot:claude-sonnet-4.6
> Signed-off-by: Zongyao Bai <zongyao.bai@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index e466f714bf86..598c6b2571e7 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -2371,8 +2371,11 @@ static void
> xe_pt_update_ops_init(struct xe_vm_pgtable_update_ops *pt_update_ops)
> {
> init_llist_head(&pt_update_ops->deferred);
> + pt_update_ops->current_op = 0;
> pt_update_ops->start = ~0x0ull;
> pt_update_ops->last = 0x0ull;
> + pt_update_ops->needs_svm_lock = false;
> + pt_update_ops->needs_invalidation = false;
> xe_page_reclaim_list_init(&pt_update_ops->prl);
> }
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-07-15 1:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 23:08 [PATCH] drm/xe/pt: Reset prepare state in xe_pt_update_ops_init() Zongyao Bai
2026-07-13 23:15 ` ✗ CI.checkpatch: warning for " Patchwork
2026-07-13 23:16 ` ✓ CI.KUnit: success " Patchwork
2026-07-13 23:51 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-14 4:33 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-14 6:31 ` [PATCH] " Matthew Brost
2026-07-14 23:24 ` [PATCH v2] drm/xe/pt: Reset current_op " Zongyao Bai
2026-07-15 1:46 ` Matthew Brost [this message]
2026-07-14 23:31 ` ✓ CI.KUnit: success for drm/xe/pt: Reset prepare state in xe_pt_update_ops_init() (rev2) Patchwork
2026-07-15 0:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-15 4:59 ` ✗ Xe.CI.FULL: failure " Patchwork
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=albmaGCoA32iIsvt@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=stable@vger.kernel.org \
--cc=zongyao.bai@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.