From: sashiko-bot@kernel.org
To: "Jan Maslak" <jan.maslak@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 2/4] drm/xe/xe_migrate: Fix page tracking in access_memory
Date: Wed, 09 Sep 2026 06:30:14 +0000 [thread overview]
Message-ID: <20260909063014.E27331F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909061845.4048047-3-jan.maslak@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Infinite recursion leading to kernel stack overflow in the unaligned bounce-buffer path when `kmalloc` does not return a cacheline-aligned address.
--
commit 3d0f83e8f2ae774cef204374c69860cdf0e2e7c3
Author: Christoph Manszewski <c.manszewski@gmail.com>
drm/xe/xe_migrate: Fix page tracking in access_memory
This commit updates xe_migrate_access_memory() to include the initial page
offset when recalculating current_page. This ensures that subsequent loop
iterations continue to index the mapped pages correctly.
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 7da57dc522896..7b8148930738d 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -2571,7 +2571,7 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
[Severity: High]
This isn't a bug introduced by this patch, but is there a risk of an
infinite recursion in the bounce-buffer path of xe_migrate_access_memory()
when memory debugging is enabled?
If xe->info.has_mem_copy_instr is false and the access is unaligned, the
code allocates a bounce buffer:
bounce = kmalloc(XE_CACHELINE_BYTES, GFP_KERNEL);
If KASAN or SLUB_DEBUG is enabled, kmalloc() may return a buffer that is
not cacheline-aligned due to redzones. The function then recursively
calls itself:
err = xe_migrate_access_memory(m, bo,
offset & ~XE_CACHELINE_MASK,
bounce,
XE_CACHELINE_BYTES, 0);
Because the bounce buffer is still unaligned, could the recursion base case
fail? This would cause it to allocate another bounce buffer and recurse
infinitely, potentially leading to a kernel stack overflow if an
unprivileged context triggers an unaligned memory access.
>
> buf += current_bytes;
> offset += current_bytes;
> - current_page = (int)(buf - orig_buf) / PAGE_SIZE;
> + current_page = (int)(buf - orig_buf + page_offset) / PAGE_SIZE;
> bytes_left -= current_bytes;
> if (bytes_left)
> xe_res_next(&cursor, current_bytes);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909061845.4048047-1-jan.maslak@intel.com?part=2
next prev parent reply other threads:[~2026-09-09 6:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 6:18 [PATCH v3 0/4] drm/xe/xe_migrate: Fix memory corruption with unaligned dst in MEM_COPY Jan Maslak
2026-09-09 6:18 ` [PATCH v3 1/4] drm/xe/xe_migrate: Align MEM_COPY pitch with destination address Jan Maslak
2026-09-09 6:32 ` sashiko-bot
2026-09-09 6:18 ` [PATCH v3 2/4] drm/xe/xe_migrate: Fix page tracking in access_memory Jan Maslak
2026-09-09 6:30 ` sashiko-bot [this message]
2026-09-09 6:18 ` [PATCH v3 3/4] drm/xe/xe_migrate: Optimize unaligned access_memory copies Jan Maslak
2026-09-09 6:31 ` sashiko-bot
2026-09-09 6:18 ` [PATCH v3 4/4] drm/xe/tests: Add xe_migrate_access_memory subtest Jan Maslak
2026-09-09 6:28 ` sashiko-bot
2026-09-09 6:25 ` ✗ CI.checkpatch: warning for drm/xe/xe_migrate: Fix memory corruption with unaligned dst in MEM_COPY (rev3) Patchwork
2026-09-09 6:27 ` ✓ CI.KUnit: success " Patchwork
2026-09-09 7:04 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-09 11:36 ` ✗ Xe.CI.FULL: " 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=20260909063014.E27331F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jan.maslak@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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