Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michał Grzelak" <michal.grzelak@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature
Date: Thu, 26 Nov 2026 18:01:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-235986@kernel.org> (raw)
In-Reply-To: <20261126175033.181407-2-michal.grzelak@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/i915/bios: 5-byte vbt_signature breaks GVT-g VBT validation
- [Low] drm/i915/bios: broken u32 needle BUILD_BUG_ON in oprom_get_vbt()
--

commit 625db8b840b34894e85859eb7f1834474d12585a
Author: Michał Grzelak <michal.grzelak@intel.com>

drm/i915/bios: include whitespace into VBT signature

This commit extends vbt_signature from "$VBT" to "$VBT " and updates the
corresponding signature length and documentation comments.

> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 7b6a6f8c3cf19..080a76a95136d 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c

[ ... ]

> @@ -3126,8 +3126,8 @@ static const struct bdb_header *get_bdb_header(const struct vbt_header *vbt)
>  	return _vbt + vbt->bdb_offset;
>  }
>  
> -static const char vbt_signature[] = "$VBT";
> -static const int vbt_signature_len = 4;
> +static const char vbt_signature[] = "$VBT ";
> +static const int vbt_signature_len = 5;

[Severity: High]
Does requiring a trailing space in vbt_signature break VBT validation for
Intel GVT-g guests?

In drivers/gpu/drm/i915/gvt/opregion.c, virt_vbt_generation() zero-fills
struct vbt and only populates the first four bytes of v->header.signature:

drivers/gpu/drm/i915/gvt/opregion.c:virt_vbt_generation() {
	memset(v, 0, sizeof(struct vbt));

	v->header.signature[0] = '$';
	v->header.signature[1] = 'V';
	v->header.signature[2] = 'B';
	v->header.signature[3] = 'T';
}

With vbt_signature_len increased to 5, intel_bios_is_valid_vbt() rejects
the emulated OpRegion VBT on both current and existing GVT-g hosts because
vbt->signature[4] is 0x00, forcing guests to fall back to default VBT port
definitions.

>  /**
>   * intel_bios_is_valid_vbt - does the given buffer contain a valid VBT
> @@ -3230,7 +3230,7 @@ static struct vbt_header *oprom_get_vbt(struct intel_display *display,
>  		return NULL;
>  
>  	BUILD_BUG_ON(vbt_signature_len != sizeof(vbt_signature) - 1);
> -	BUILD_BUG_ON(vbt_signature_len != sizeof(u32));
> +	BUILD_BUG_ON(vbt_signature_len != sizeof(u32) + 1);
>  
>  	offset = intel_rom_find(rom, *(const u32 *)vbt_signature);
>  	if (offset < 0)

[Severity: Low]
Does changing this BUILD_BUG_ON to sizeof(u32) + 1 defeat the check that
intel_rom_find() searches for the full vbt_signature?

intel_rom_find() only matches a 32-bit u32 needle and returns the first
4-byte "$VBT" match in the Option ROM without checking the fifth byte, so
any earlier 4-byte "$VBT" sequence without a trailing space will stop the
ROM scan and cause intel_bios_is_valid_vbt() to fail.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126175033.181407-1-michal.grzelak@linux.intel.com?part=1

  reply	other threads:[~2026-11-26 18:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 17:50 [PATCH v1 0/2] drm/i915/bios: vbt-related fixes Michał Grzelak
2026-11-26 17:50 ` [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature Michał Grzelak
2026-11-26 18:01   ` sashiko-bot [this message]
2026-11-26 17:50 ` [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed Michał Grzelak
2026-11-26 18:04   ` sashiko-bot

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=sashiko-outbox-235986@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.grzelak@linux.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