From: sashiko-bot@kernel.org
To: "Alan Previn" <alan.previn.teres.alexis@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 2/2] drm/xe/guc: Compress GuC log and CTB dump with zstd
Date: Wed, 02 Sep 2026 22:59:03 +0000 [thread overview]
Message-ID: <20260902225904.180AE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902224417.879960-6-alan.previn.teres.alexis@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing bounds check in `xe_guc_log_load_lic` when parsing untrusted GuC log.
--
commit 91217fd983f065c8684178f4aa349f4bc46ae614
Author: Zhanjun Dong <zhanjun.dong@intel.com>
Subject: drm/xe/guc: Compress GuC log and CTB dump with zstd
With default settings, GuC log is 8MB in size and dumping the log is
time-consuming. In debugging scenarios, dump-to-dmesg suffers truncation loss
because CI's size limit is 2MB. Thus, compress the GuC log data dump to
address these issues and multiply any benefits from a future upgrade in CI's
size limits.
> diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
> index 538d4df0f7aa7..aaeb0f76af305 100644
> --- a/drivers/gpu/drm/xe/xe_guc_log.c
> +++ b/drivers/gpu/drm/xe/xe_guc_log.c
[ ... ]
> @@ -248,16 +383,9 @@ void xe_guc_log_snapshot_print(struct xe_guc_log_snapshot *snapshot, struct drm_
> drm_printf(p, "GuC timestamp: 0x%08llX [%llu]\n", snapshot->stamp, snapshot->stamp);
> drm_printf(p, "Log level: %u\n", snapshot->level);
>
> - drm_printf(p, "[LOG].length: 0x%zx\n", snapshot->size);
> - remain = snapshot->size;
> - for (i = 0; i < snapshot->num_chunks; i++) {
> - size_t size = min(GUC_LOG_CHUNK_SIZE, remain);
> - const char *prefix = i ? NULL : "[LOG].data";
> - char suffix = i == snapshot->num_chunks - 1 ? '\n' : 0;
> -
> - xe_print_blob_ascii85(p, prefix, suffix, snapshot->copy[i], 0, size);
> - remain -= size;
> - }
> + xe_guc_print_blob(gt, p, "[LOG]", "[LOG].data",
> + snapshot->copy, snapshot->num_chunks,
> + GUC_LOG_CHUNK_SIZE, snapshot->size);
> }
[Severity: High]
This isn't a bug introduced by this patch, but does xe_guc_log_load_lic()
have a missing bounds check when parsing an untrusted GuC log?
The function xe_guc_log_load_lic() parses an untrusted log buffer mapped
from the GuC firmware:
drivers/gpu/drm/xe/xe_guc_log.c:xe_guc_log_load_lic() {
while (p->marker[0]) {
int index;
...
offset += p->size;
p++;
}
}
The loop unconditionally increments p without verifying that it remains
within the bounds of the snapshot->copy[0] buffer. If the firmware buffer
is corrupted, malicious, or lacks the zero marker, the loop will increment
p past the end of the buffer (which is limited to GUC_LOG_CHUNK_SIZE).
Can this cause an out-of-bounds dereference on p->marker[0] and subsequent
fields? Since this is reachable via user-space by reading the GuC log debugfs
file (which triggers xe_guc_log_print_lfd() -> xe_guc_log_load_lic()), a
compromised or buggy firmware could potentially cause a local DoS or system
crash.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902224417.879960-4-alan.previn.teres.alexis@intel.com?part=2
next prev parent reply other threads:[~2026-09-02 22:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 15:54 [PATCH v7 0/2] drm/xe/guc: Compress GuC log and CTB dump with zstd Zhanjun Dong
2026-07-31 15:54 ` [PATCH v7 1/2] drm/xe: Remove extra newlines from LRC snapshot dump Zhanjun Dong
2026-07-31 15:54 ` [PATCH v7 2/2] drm/xe/guc: Compress GuC log and CTB dump with zstd Zhanjun Dong
2026-08-05 1:07 ` Rodrigo Vivi
2026-08-05 13:47 ` Souza, Jose
2026-07-31 16:00 ` ✗ CI.checkpatch: warning for drm/xe/guc: Compress GuC log and CTB dump with zstd (rev3) Patchwork
2026-07-31 16:01 ` ✓ CI.KUnit: success " Patchwork
2026-07-31 16:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-31 17:39 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-02 22:44 ` [PATCH v8 0/2] drm/xe/guc: Compress GuC log and CTB dump with zstd Alan Previn
2026-09-02 22:44 ` [PATCH v8 1/2] drm/xe: Remove extra newlines from LRC snapshot dump Alan Previn
2026-09-02 22:44 ` [PATCH v8 2/2] drm/xe/guc: Compress GuC log and CTB dump with zstd Alan Previn
2026-09-02 22:59 ` sashiko-bot [this message]
2026-09-02 23:37 ` [PATCH v8 0/2] " Teres Alexis, Alan Previn
-- strict thread matches above, loose matches on Subject: below --
2026-09-02 23:40 Alan Previn
2026-09-02 23:40 ` [PATCH v8 2/2] " Alan Previn
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=20260902225904.180AE1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alan.previn.teres.alexis@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