Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Gustavo Sousa" <gustavo.sousa@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 3/3] drm/xe: Add up-to-date implementation for Wa_14026539277
Date: Fri, 21 Aug 2026 21:52:26 +0000	[thread overview]
Message-ID: <20260821215227.4E8481F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821-wa_14026539277-v3-3-1f98c2af12f6@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Spectre v1 vulnerability due to missing use of mitigated array index in `xe_vm_madvise_ioctl`.
--

--- Patch [3]: [PATCH v3 3/3] drm/xe: Add up-to-date implementation for Wa_14026539277 ---
commit a64f477e6e9a2ceb517c012bf3dbfd5ac3afdd27
Author: Gustavo Sousa <gustavo.sousa@intel.com>
Subject: drm/xe: Add up-to-date implementation for Wa_14026539277

This commit updates the implementation for Wa_14026539277. It converts
device-cacheable accesses to device-uncached and 1-way-coherent for
driver-internal usage, and rejects 2-way-coherent VM_BIND/MADVISE calls
on the UAPI side.

[ ... ]

> diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
> index 0474768a38aaa..265273294756c 100644
> --- a/drivers/gpu/drm/xe/xe_vm_madvise.c
> +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
> @@ -500,6 +500,9 @@ static bool check_pat_args_are_sane(struct xe_device *xe,
>  	u16 coh_mode = xe_pat_index_get_coh_mode(xe, pat_index);
>  	int i;
>  
> +	if (XE_IOCTL_DBG(xe, xe_pat_wa_14026539277_reserved(xe, pat_index)))
> +		return false;
> +

[Severity: High]
This is a pre-existing issue, but does this addition exacerbate a Spectre v1
vulnerability by adding another speculative out-of-bounds access?

In xe_vm_madvise_ioctl(), array_index_nospec() is used to mitigate the index,
but its result is discarded and the raw unmitigated args->pat_index.val is
passed to check_pat_args_are_sane():

drivers/gpu/drm/xe/xe_vm_madvise.c:xe_vm_madvise_ioctl() {
    ...
		pat_index = array_index_nospec(args->pat_index.val, xe->pat.n_entries);
		coh_mode = xe_pat_index_get_coh_mode(xe, pat_index);
    ...
	if (args->type == DRM_XE_MEM_RANGE_ATTR_PAT) {
		if (!check_pat_args_are_sane(xe, &madvise_range,
					     args->pat_index.val)) {
    ...
}

This means check_pat_args_are_sane() receives the unmitigated index. It then
passes it to xe_pat_index_get_coh_mode() and now to
xe_pat_wa_14026539277_reserved(), both of which will access the
xe->pat.table array.

Since the ioctl is accessible to userspace, an attacker could provide a
maliciously crafted args->pat_index.val exceeding xe->pat.n_entries and
trigger speculative out-of-bounds array reads. Should the caller be updated
to pass the mitigated pat_index?

>  	/*
>  	 * Using coh_none with CPU cached buffers is not allowed on iGPU.
>  	 * On iGPU the GPU shares the LLC with the CPU, so with coh_none

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260821-wa_14026539277-v3-0-1f98c2af12f6@intel.com?part=3

  parent reply	other threads:[~2026-08-21 21:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 21:36 [PATCH v3 0/3] drm/xe: Update Wa_14026539277 Gustavo Sousa
2026-08-21 21:36 ` [PATCH v3 1/3] drm/xe: Extract override_has_cached_pt() Gustavo Sousa
2026-08-21 21:36 ` [PATCH v3 2/3] Revert "drm/xe/nvlp: Implement Wa_14026539277" Gustavo Sousa
2026-08-21 21:36 ` [PATCH v3 3/3] drm/xe: Add up-to-date implementation for Wa_14026539277 Gustavo Sousa
2026-08-21 21:42   ` Gustavo Sousa
2026-08-24  6:59     ` Hazubski, Filip
2026-08-21 21:52   ` sashiko-bot [this message]
2026-08-21 21:43 ` ✗ CI.checkpatch: warning for drm/xe: Update Wa_14026539277 Patchwork
2026-08-21 21:44 ` ✓ CI.KUnit: success " Patchwork
2026-08-21 22:42 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-21 23:52 ` ✗ 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=20260821215227.4E8481F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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