public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>
Subject: Re: [PATCH] drm/xe: Fix overflow in guc_ct_snapshot_capture
Date: Wed, 4 Mar 2026 08:39:06 -0800	[thread overview]
Message-ID: <aahgKt4kHpXWwenB@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260304112501.230992-1-mika.kuoppala@linux.intel.com>

On Wed, Mar 04, 2026 at 01:25:01PM +0200, Mika Kuoppala wrote:
> snapshot->ctb is u32*, so pointer arithmetic on it scales
> the byte offset from xe_bo_size() by 4, overshooting the
> intended start of the g2h portion and writing past the
> allocated buffer.
> 
> Fix this by using *u8 to get the arithmetic right and also
> prevent future mishaps.
> 
> Fixes: af3de6cf06f9 ("drm/xe: Split H2G and G2H into separate buffer objects")
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: intel-xe@lists.freedesktop.org
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_ct_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct_types.h b/drivers/gpu/drm/xe/xe_guc_ct_types.h
> index 46ad1402347d..1b4b9b713d42 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct_types.h
> +++ b/drivers/gpu/drm/xe/xe_guc_ct_types.h
> @@ -74,7 +74,7 @@ struct xe_guc_ct_snapshot {
>  	/** @ctb_size: size of the snapshot of the CTB */
>  	size_t ctb_size;
>  	/** @ctb: snapshot of the entire CTB */
> -	u32 *ctb;
> +	u8 *ctb;

Ah, I see the issue. Maybe 'void *ctb'?

Matt

>  };
>  
>  /**
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-03-04 16:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 11:25 [PATCH] drm/xe: Fix overflow in guc_ct_snapshot_capture Mika Kuoppala
2026-03-04 16:39 ` Matthew Brost [this message]
2026-03-04 18:39   ` Mika Kuoppala
2026-03-04 19:07     ` Matthew Brost
2026-03-04 21:17 ` Mika Kuoppala
2026-03-04 21:37   ` Matthew Brost
2026-03-04 21:46 ` ✓ CI.KUnit: success for " Patchwork
2026-03-05  5:35 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-05 10:59 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-05 22:08 ` ✓ CI.KUnit: success for drm/xe: Fix overflow in guc_ct_snapshot_capture (rev2) Patchwork
2026-03-05 22:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-06 16:04 ` ✓ 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=aahgKt4kHpXWwenB@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox