Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stuart Summers" <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set
Date: Thu, 20 Aug 2026 21:24:03 +0000	[thread overview]
Message-ID: <20260820212403.CA13D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820210639.107524-22-stuart.summers@intel.com>

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

Pre-existing issues:
- [High] An out-of-bounds read occurs in parse_wa_bb_lines when parsing a configfs string that does not end with a newline or whitespace.
--

--- Patch [10]: [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set ---
commit 7e0ffcb5910459cff420b85bbfb7e80c0fa6b9b1
Author: Stuart Summers <stuart.summers@intel.com>

drm/xe: Taint kernel when debug configfs parameters are set

Writing any debug configfs attribute indicates the system is running
in a non-standard configuration that may mask bugs or produce misleading
behaviour. Taint the kernel with TAINT_TEST on each successful write so
bug reports clearly reflect when debug settings were active.

> diff --git a/drivers/gpu/drm/xe/xe_configfs_debug.c b/drivers/gpu/drm/xe/xe_configfs_debug.c
> index 2429d11f27a75..6cd206ec2ec4f 100644
> --- a/drivers/gpu/drm/xe/xe_configfs_debug.c
> +++ b/drivers/gpu/drm/xe/xe_configfs_debug.c
[ ... ]
> @@ -528,6 +533,7 @@ static ssize_t wa_bb_store(struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX],
>  
>  	if (!count) {
>  		memset(wa_bb, 0, sizeof(tmp_wa_bb));
> +		add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
>  		return len;
>  	}

[Severity: High]
This isn't a bug introduced by this patch, but can this lead to an
out-of-bounds read in parse_wa_bb_lines() when called from wa_bb_store()?

If userspace writes a string to the configfs attribute that does not end
with a trailing newline (e.g., echo -n 'rcs cmd 1'), the inner parsing
logic in parse_wa_bb_lines() processes the tokens and leaves the pointer
at the null terminator:

drivers/gpu/drm/xe/xe_configfs_debug.c:parse_wa_bb_lines() {
    ...
    for (p = lines; *p; p++) {
        ...
        if (str_has_prefix(p, "cmd")) {
            for (p += strlen("cmd"); *p;) {
                ret = parse_hex(p, &val);
                ...
                p += ret;
            }
        }
        ...
    }
}

Because the outer loop unconditionally increments the pointer with p++ at the
end of each iteration, if p is already at the null terminator ('\0') after
the inner parsing, p++ pushes it out-of-bounds. The subsequent outer loop
condition check *p then reads out-of-bounds memory.

If the configfs input string is exactly 4095 bytes long, this read could
cross the PAGE_SIZE boundary of the allocated buffer and trigger a kernel
panic.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820210639.107524-12-stuart.summers@intel.com?part=10

  reply	other threads:[~2026-08-20 21:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 21:06 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-20 21:06 ` [PATCH 01/10] drm/xe: Guard configfs attribute reads in getters Stuart Summers
2026-08-20 21:24   ` sashiko-bot
2026-08-20 21:06 ` [PATCH 02/10] drm/xe: Sort xe_config_device fields Stuart Summers
2026-08-20 21:24   ` sashiko-bot
2026-08-20 21:06 ` [PATCH 03/10] drm/xe: Split out configfs data structures Stuart Summers
2026-08-20 21:06 ` [PATCH 04/10] drm/xe: Add a new debug focused configfs group Stuart Summers
2026-08-20 21:06 ` [PATCH 05/10] drm/xe: Move debug configfs entries to xe_configfs_debug.c Stuart Summers
2026-08-20 21:28   ` sashiko-bot
2026-08-20 21:06 ` [PATCH 06/10] drm/xe/guc: Add configfs support for guc_log_level Stuart Summers
2026-08-20 21:06 ` [PATCH 07/10] drm/xe/guc: Add support for NPK as a GuC log target Stuart Summers
2026-08-20 21:06 ` [PATCH 08/10] drm/xe: Add infrastructure for debug configfs parameters Stuart Summers
2026-08-20 21:06 ` [PATCH 09/10] drm/xe: Migrate existing debug configfs entries to params infrastructure Stuart Summers
2026-08-20 21:06 ` [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-08-20 21:24   ` sashiko-bot [this message]
2026-08-20 22:12 ` ✗ CI.checkpatch: warning for Add new debug infrastructure for configfs (rev7) Patchwork
2026-08-20 22:13 ` ✓ CI.KUnit: success " Patchwork
2026-08-20 22:52 ` ✓ Xe.CI.BAT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2026-08-20 20:07 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-20 20:07 ` [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-08-07 19:45 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-07 19:45 ` [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-08-05 23:20 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-05 23:20 ` [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers

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=20260820212403.CA13D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stuart.summers@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