linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
@ 2025-11-02  0:13 Francesco Pompo
  2025-11-03  8:19 ` Ard Biesheuvel
  2025-11-06 13:08 ` Dan Carpenter
  0 siblings, 2 replies; 9+ messages in thread
From: Francesco Pompo @ 2025-11-02  0:13 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, linux-kernel, Francesco Pompo

Some UEFI firmware implementations do not provide the SMBIOS Protocol,
causing efi_get_smbios_record() to fail. This prevents retrieval of
system information such as product name, which is needed by
apple_set_os() to enable the integrated GPU on dual-graphics Intel
MacBooks.

Add a fallback that directly parses the SMBIOS entry point table when
the protocol is unavailable. Log when the fallback is used.

Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
---
 drivers/firmware/efi/libstub/efistub.h | 17 +++++
 drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
 2 files changed, 113 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index 685098f9626f..68582ce81370 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -1151,6 +1151,23 @@ void free_screen_info(struct screen_info *si);
 void efi_cache_sync_image(unsigned long image_base,
 			  unsigned long alloc_size);
 
+struct __packed smbios_entry_point {
+	char anchor[4];
+	u8 ep_checksum;
+	u8 ep_length;
+	u8 major_version;
+	u8 minor_version;
+	u16 max_size_entry;
+	u8 ep_rev;
+	u8 reserved[5];
+	char int_anchor[5];
+	u8 int_checksum;
+	u16 st_length;
+	u32 st_address;
+	u16 number_of_entries;
+	u8 bcd_rev;
+};
+
 struct efi_smbios_record {
 	u8	type;
 	u8	length;
diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c
index f31410d7e7e1..21f499035b37 100644
--- a/drivers/firmware/efi/libstub/smbios.c
+++ b/drivers/firmware/efi/libstub/smbios.c
@@ -33,6 +33,93 @@ union efi_smbios_protocol {
 	} mixed_mode;
 };
 
+static bool verify_ep_checksum(const struct smbios_entry_point *ep)
+{
+	const u8 *ptr = (u8 *)ep;
+	u8 sum = 0;
+	int i;
+
+	for (i = 0; i < ep->ep_length; i++)
+		sum += ptr[i];
+
+	return sum == 0;
+}
+
+static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
+{
+	const u8 *ptr = (u8 *)&ep->int_anchor;
+	u8 sum = 0;
+	int i;
+
+	for (i = 0; i < 15; i++)
+		sum += ptr[i];
+
+	return sum == 0;
+}
+
+static bool verify_ep_integrity(const struct smbios_entry_point *ep)
+{
+	if (memcmp(ep->anchor, "_SM_", sizeof(ep->anchor)) != 0)
+		return false;
+
+	if (memcmp(ep->int_anchor, "_DMI_", sizeof(ep->int_anchor)) != 0)
+		return false;
+
+	if (!verify_ep_checksum(ep) || !verify_ep_int_checksum(ep))
+		return false;
+
+	return true;
+}
+
+static const struct efi_smbios_record *search_record(void *table, u32 length,
+						     u8 type)
+{
+	const u8 *p, *end;
+
+	p = (u8 *)table;
+	end = p + length;
+
+	while (p + sizeof(struct efi_smbios_record) < end) {
+		const struct efi_smbios_record *hdr =
+			(struct efi_smbios_record *)p;
+		const u8 *next;
+
+		if (hdr->type == type)
+			return hdr;
+
+		/* Type 127 = End-of-Table */
+		if (hdr->type == 0x7F)
+			return NULL;
+
+		/* Jumping to the unformed section */
+		next = p + hdr->length;
+
+		/* Unformed section ends with 0000h */
+		while ((next[0] != 0 || next[1] != 0) && next + 1 < end)
+			next++;
+
+		next += 2;
+		p = next;
+	}
+
+	return NULL;
+}
+
+static const struct efi_smbios_record *get_table_record(u8 type)
+{
+	const struct smbios_entry_point *ep;
+
+	ep = get_efi_config_table(SMBIOS_TABLE_GUID);
+	if (!ep)
+		return NULL;
+
+	if (!verify_ep_integrity(ep))
+		return NULL;
+
+	return search_record((void *)(unsigned long)ep->st_address,
+		ep->st_length, type);
+}
+
 const struct efi_smbios_record *efi_get_smbios_record(u8 type)
 {
 	struct efi_smbios_record *record;
@@ -43,9 +130,15 @@ const struct efi_smbios_record *efi_get_smbios_record(u8 type)
 	status = efi_bs_call(locate_protocol, &EFI_SMBIOS_PROTOCOL_GUID, NULL,
 			     (void **)&smbios) ?:
 		 efi_call_proto(smbios, get_next, &handle, &type, &record, NULL);
-	if (status != EFI_SUCCESS)
-		return NULL;
-	return record;
+	if (status == EFI_SUCCESS)
+		return record;
+
+	efi_info(
+		"Cannot access SMBIOS protocol (status 0x%lx), parsing table directly\n",
+		status
+	);
+
+	return get_table_record(type);
 }
 
 const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-02  0:13 [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup Francesco Pompo
@ 2025-11-03  8:19 ` Ard Biesheuvel
  2025-11-03 10:14   ` Francesco Pompò
  2025-11-06 13:08 ` Dan Carpenter
  1 sibling, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2025-11-03  8:19 UTC (permalink / raw)
  To: Francesco Pompo; +Cc: linux-efi, linux-kernel

Hello Francesco,

On Sun, 2 Nov 2025 at 01:14, Francesco Pompo <francescopompo2@gmail.com> wrote:
>
> Some UEFI firmware implementations do not provide the SMBIOS Protocol,
> causing efi_get_smbios_record() to fail. This prevents retrieval of
> system information such as product name, which is needed by
> apple_set_os() to enable the integrated GPU on dual-graphics Intel
> MacBooks.
>
> Add a fallback that directly parses the SMBIOS entry point table when
> the protocol is unavailable. Log when the fallback is used.
>
> Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
> ---
>  drivers/firmware/efi/libstub/efistub.h | 17 +++++
>  drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
>  2 files changed, 113 insertions(+), 3 deletions(-)
>

On which platform does this fix an actual existing issue?

> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index 685098f9626f..68582ce81370 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -1151,6 +1151,23 @@ void free_screen_info(struct screen_info *si);
>  void efi_cache_sync_image(unsigned long image_base,
>                           unsigned long alloc_size);
>
> +struct __packed smbios_entry_point {
> +       char anchor[4];
> +       u8 ep_checksum;
> +       u8 ep_length;
> +       u8 major_version;
> +       u8 minor_version;
> +       u16 max_size_entry;
> +       u8 ep_rev;
> +       u8 reserved[5];
> +       char int_anchor[5];
> +       u8 int_checksum;
> +       u16 st_length;
> +       u32 st_address;
> +       u16 number_of_entries;
> +       u8 bcd_rev;
> +};
> +
>  struct efi_smbios_record {
>         u8      type;
>         u8      length;
> diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c
> index f31410d7e7e1..21f499035b37 100644
> --- a/drivers/firmware/efi/libstub/smbios.c
> +++ b/drivers/firmware/efi/libstub/smbios.c
> @@ -33,6 +33,93 @@ union efi_smbios_protocol {
>         } mixed_mode;
>  };
>
> +static bool verify_ep_checksum(const struct smbios_entry_point *ep)
> +{
> +       const u8 *ptr = (u8 *)ep;
> +       u8 sum = 0;
> +       int i;
> +
> +       for (i = 0; i < ep->ep_length; i++)
> +               sum += ptr[i];
> +
> +       return sum == 0;
> +}
> +
> +static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
> +{
> +       const u8 *ptr = (u8 *)&ep->int_anchor;
> +       u8 sum = 0;
> +       int i;
> +
> +       for (i = 0; i < 15; i++)
> +               sum += ptr[i];
> +
> +       return sum == 0;
> +}
> +
> +static bool verify_ep_integrity(const struct smbios_entry_point *ep)
> +{
> +       if (memcmp(ep->anchor, "_SM_", sizeof(ep->anchor)) != 0)
> +               return false;
> +
> +       if (memcmp(ep->int_anchor, "_DMI_", sizeof(ep->int_anchor)) != 0)
> +               return false;
> +
> +       if (!verify_ep_checksum(ep) || !verify_ep_int_checksum(ep))
> +               return false;
> +
> +       return true;
> +}
> +
> +static const struct efi_smbios_record *search_record(void *table, u32 length,
> +                                                    u8 type)
> +{
> +       const u8 *p, *end;
> +
> +       p = (u8 *)table;
> +       end = p + length;
> +
> +       while (p + sizeof(struct efi_smbios_record) < end) {
> +               const struct efi_smbios_record *hdr =
> +                       (struct efi_smbios_record *)p;
> +               const u8 *next;
> +
> +               if (hdr->type == type)
> +                       return hdr;
> +
> +               /* Type 127 = End-of-Table */
> +               if (hdr->type == 0x7F)
> +                       return NULL;
> +
> +               /* Jumping to the unformed section */
> +               next = p + hdr->length;
> +
> +               /* Unformed section ends with 0000h */
> +               while ((next[0] != 0 || next[1] != 0) && next + 1 < end)
> +                       next++;
> +
> +               next += 2;
> +               p = next;
> +       }
> +
> +       return NULL;
> +}
> +
> +static const struct efi_smbios_record *get_table_record(u8 type)
> +{
> +       const struct smbios_entry_point *ep;
> +
> +       ep = get_efi_config_table(SMBIOS_TABLE_GUID);
> +       if (!ep)
> +               return NULL;
> +
> +       if (!verify_ep_integrity(ep))
> +               return NULL;
> +
> +       return search_record((void *)(unsigned long)ep->st_address,
> +               ep->st_length, type);
> +}
> +
>  const struct efi_smbios_record *efi_get_smbios_record(u8 type)
>  {
>         struct efi_smbios_record *record;
> @@ -43,9 +130,15 @@ const struct efi_smbios_record *efi_get_smbios_record(u8 type)
>         status = efi_bs_call(locate_protocol, &EFI_SMBIOS_PROTOCOL_GUID, NULL,
>                              (void **)&smbios) ?:
>                  efi_call_proto(smbios, get_next, &handle, &type, &record, NULL);
> -       if (status != EFI_SUCCESS)
> -               return NULL;
> -       return record;
> +       if (status == EFI_SUCCESS)
> +               return record;
> +
> +       efi_info(
> +               "Cannot access SMBIOS protocol (status 0x%lx), parsing table directly\n",
> +               status
> +       );
> +
> +       return get_table_record(type);
>  }
>
>  const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
> --
> 2.51.0
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-03  8:19 ` Ard Biesheuvel
@ 2025-11-03 10:14   ` Francesco Pompò
  2025-11-03 10:41     ` Ard Biesheuvel
  2025-11-03 13:11     ` Ard Biesheuvel
  0 siblings, 2 replies; 9+ messages in thread
From: Francesco Pompò @ 2025-11-03 10:14 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, linux-kernel

Il giorno lun 3 nov 2025 alle ore 09:19 Ard Biesheuvel
<ardb@kernel.org> ha scritto:
>
> Hello Francesco,
>
> On Sun, 2 Nov 2025 at 01:14, Francesco Pompo <francescopompo2@gmail.com> wrote:
> >
> > Some UEFI firmware implementations do not provide the SMBIOS Protocol,
> > causing efi_get_smbios_record() to fail. This prevents retrieval of
> > system information such as product name, which is needed by
> > apple_set_os() to enable the integrated GPU on dual-graphics Intel
> > MacBooks.
> >
> > Add a fallback that directly parses the SMBIOS entry point table when
> > the protocol is unavailable. Log when the fallback is used.
> >
> > Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
> > ---
> >  drivers/firmware/efi/libstub/efistub.h | 17 +++++
> >  drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
> >  2 files changed, 113 insertions(+), 3 deletions(-)
> >
>
> On which platform does this fix an actual existing issue?

Hello Ard,

My Macbook Pro Late 2013, product name Macbook11,3 is affected.
Specifically at least the firmware version 478.0.0.0.0, released on
01/13/2023. I have no way to downgrade to check for other versions.

From what I have read on internet this should not be the only model to
be affected.

The issue is that apple_match_product_name() fails to obtain its info
via efi_get_smbios_record() and makes apple_set_os() fail too.

-- 
Francesco Pompo'

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-03 10:14   ` Francesco Pompò
@ 2025-11-03 10:41     ` Ard Biesheuvel
  2025-11-03 13:11     ` Ard Biesheuvel
  1 sibling, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2025-11-03 10:41 UTC (permalink / raw)
  To: Francesco Pompò; +Cc: linux-efi, linux-kernel

On Mon, 3 Nov 2025 at 11:15, Francesco Pompò <francescopompo2@gmail.com> wrote:
>
> Il giorno lun 3 nov 2025 alle ore 09:19 Ard Biesheuvel
> <ardb@kernel.org> ha scritto:
> >
> > Hello Francesco,
> >
> > On Sun, 2 Nov 2025 at 01:14, Francesco Pompo <francescopompo2@gmail.com> wrote:
> > >
> > > Some UEFI firmware implementations do not provide the SMBIOS Protocol,
> > > causing efi_get_smbios_record() to fail. This prevents retrieval of
> > > system information such as product name, which is needed by
> > > apple_set_os() to enable the integrated GPU on dual-graphics Intel
> > > MacBooks.
> > >
> > > Add a fallback that directly parses the SMBIOS entry point table when
> > > the protocol is unavailable. Log when the fallback is used.
> > >
> > > Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
> > > ---
> > >  drivers/firmware/efi/libstub/efistub.h | 17 +++++
> > >  drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
> > >  2 files changed, 113 insertions(+), 3 deletions(-)
> > >
> >
> > On which platform does this fix an actual existing issue?
>
> Hello Ard,
>
> My Macbook Pro Late 2013, product name Macbook11,3 is affected.
> Specifically at least the firmware version 478.0.0.0.0, released on
> 01/13/2023. I have no way to downgrade to check for other versions.
>
> From what I have read on internet this should not be the only model to
> be affected.
>
> The issue is that apple_match_product_name() fails to obtain its info
> via efi_get_smbios_record() and makes apple_set_os() fail too.
>

Fair enough.

But please move get_table_record() into x86-stub.c and call it
directly from apple_match_product_name() if the call to
efi_get_smbios_record() returns NULL. That way, the fallback is only
used where we know it is needed, and we don't go down this direct
path, e.g., on random arm64 boxes.

Also, struct smbios_entry_point can be moved into the .c file, as it
is not used anywhere else. And you can drop the __packed, I think - if
it is needed for alignment, you can use __aligned(1) instead (but all
the fields seem to be naturally aligned afaict)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-03 10:14   ` Francesco Pompò
  2025-11-03 10:41     ` Ard Biesheuvel
@ 2025-11-03 13:11     ` Ard Biesheuvel
  2025-11-03 13:14       ` francesco
  1 sibling, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2025-11-03 13:11 UTC (permalink / raw)
  To: Francesco Pompò; +Cc: linux-efi, linux-kernel

On Mon, 3 Nov 2025 at 11:15, Francesco Pompò <francescopompo2@gmail.com> wrote:
>
> Il giorno lun 3 nov 2025 alle ore 09:19 Ard Biesheuvel
> <ardb@kernel.org> ha scritto:
> >
> > Hello Francesco,
> >
> > On Sun, 2 Nov 2025 at 01:14, Francesco Pompo <francescopompo2@gmail.com> wrote:
> > >
> > > Some UEFI firmware implementations do not provide the SMBIOS Protocol,
> > > causing efi_get_smbios_record() to fail. This prevents retrieval of
> > > system information such as product name, which is needed by
> > > apple_set_os() to enable the integrated GPU on dual-graphics Intel
> > > MacBooks.
> > >
> > > Add a fallback that directly parses the SMBIOS entry point table when
> > > the protocol is unavailable. Log when the fallback is used.
> > >
> > > Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
> > > ---
> > >  drivers/firmware/efi/libstub/efistub.h | 17 +++++
> > >  drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
> > >  2 files changed, 113 insertions(+), 3 deletions(-)
> > >
> >
> > On which platform does this fix an actual existing issue?
>
> Hello Ard,
>
> My Macbook Pro Late 2013, product name Macbook11,3 is affected.

You meant MacbookPro11,3, right?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-03 13:11     ` Ard Biesheuvel
@ 2025-11-03 13:14       ` francesco
  0 siblings, 0 replies; 9+ messages in thread
From: francesco @ 2025-11-03 13:14 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Francesco Pompò, linux-efi, linux-kernel

On Mon, Nov 03, 2025 at 02:11:31PM +0100, Ard Biesheuvel wrote:
> On Mon, 3 Nov 2025 at 11:15, Francesco Pompò <francescopompo2@gmail.com> wrote:
> >
> > Il giorno lun 3 nov 2025 alle ore 09:19 Ard Biesheuvel
> > <ardb@kernel.org> ha scritto:
> > >
> > > Hello Francesco,
> > >
> > > On Sun, 2 Nov 2025 at 01:14, Francesco Pompo <francescopompo2@gmail.com> wrote:
> > > >
> > > > Some UEFI firmware implementations do not provide the SMBIOS Protocol,
> > > > causing efi_get_smbios_record() to fail. This prevents retrieval of
> > > > system information such as product name, which is needed by
> > > > apple_set_os() to enable the integrated GPU on dual-graphics Intel
> > > > MacBooks.
> > > >
> > > > Add a fallback that directly parses the SMBIOS entry point table when
> > > > the protocol is unavailable. Log when the fallback is used.
> > > >
> > > > Signed-off-by: Francesco Pompo <francescopompo2@gmail.com>
> > > > ---
> > > >  drivers/firmware/efi/libstub/efistub.h | 17 +++++
> > > >  drivers/firmware/efi/libstub/smbios.c  | 99 +++++++++++++++++++++++++-
> > > >  2 files changed, 113 insertions(+), 3 deletions(-)
> > > >
> > >
> > > On which platform does this fix an actual existing issue?
> >
> > Hello Ard,
> >
> > My Macbook Pro Late 2013, product name Macbook11,3 is affected.
> 
> You meant MacbookPro11,3, right?

Yes sorry. Anyway I sent a PATCH v2 email.

-- 
Francesco Pompo'

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-02  0:13 [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup Francesco Pompo
  2025-11-03  8:19 ` Ard Biesheuvel
@ 2025-11-06 13:08 ` Dan Carpenter
  2025-11-06 17:50   ` Ard Biesheuvel
  1 sibling, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2025-11-06 13:08 UTC (permalink / raw)
  To: oe-kbuild, Francesco Pompo, Ard Biesheuvel
  Cc: lkp, oe-kbuild-all, linux-efi, linux-kernel, Francesco Pompo

Hi Francesco,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Francesco-Pompo/efistub-smbios-Add-fallback-for-SMBIOS-record-lookup/20251102-081803
base:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
patch link:    https://lore.kernel.org/r/20251102001411.108385-1-francescopompo2%40gmail.com
patch subject: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
config: i386-randconfig-141-20251103 (https://download.01.org/0day-ci/archive/20251104/202511040131.8yGeRa6u-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202511040131.8yGeRa6u-lkp@intel.com/

smatch warnings:
drivers/firmware/efi/libstub/smbios.c:55 verify_ep_int_checksum() error: buffer overflow 'ptr' 5 <= 14

vim +/ptr +55 drivers/firmware/efi/libstub/smbios.c

d45578057224c4 Francesco Pompo 2025-11-02  48  static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
d45578057224c4 Francesco Pompo 2025-11-02  49  {
d45578057224c4 Francesco Pompo 2025-11-02  50  	const u8 *ptr = (u8 *)&ep->int_anchor;
d45578057224c4 Francesco Pompo 2025-11-02  51  	u8 sum = 0;
d45578057224c4 Francesco Pompo 2025-11-02  52  	int i;
d45578057224c4 Francesco Pompo 2025-11-02  53  
d45578057224c4 Francesco Pompo 2025-11-02  54  	for (i = 0; i < 15; i++)
d45578057224c4 Francesco Pompo 2025-11-02 @55  		sum += ptr[i];

This loop reads across a bunch of struct members.  We would normally
use a struct_group() to say that all the struct members are grouped
together.

d45578057224c4 Francesco Pompo 2025-11-02  56  
d45578057224c4 Francesco Pompo 2025-11-02  57  	return sum == 0;
d45578057224c4 Francesco Pompo 2025-11-02  58  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-06 13:08 ` Dan Carpenter
@ 2025-11-06 17:50   ` Ard Biesheuvel
  2025-11-06 22:58     ` Philip Li
  0 siblings, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2025-11-06 17:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, Francesco Pompo, lkp, oe-kbuild-all, linux-efi,
	linux-kernel

Hi Dan,

On Thu, 6 Nov 2025 at 14:08, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Hi Francesco,
>
> kernel test robot noticed the following build warnings:
>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Francesco-Pompo/efistub-smbios-Add-fallback-for-SMBIOS-record-lookup/20251102-081803
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
> patch link:    https://lore.kernel.org/r/20251102001411.108385-1-francescopompo2%40gmail.com
> patch subject: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
> config: i386-randconfig-141-20251103 (https://download.01.org/0day-ci/archive/20251104/202511040131.8yGeRa6u-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202511040131.8yGeRa6u-lkp@intel.com/
>
> smatch warnings:
> drivers/firmware/efi/libstub/smbios.c:55 verify_ep_int_checksum() error: buffer overflow 'ptr' 5 <= 14
>
> vim +/ptr +55 drivers/firmware/efi/libstub/smbios.c
>
> d45578057224c4 Francesco Pompo 2025-11-02  48  static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
> d45578057224c4 Francesco Pompo 2025-11-02  49  {
> d45578057224c4 Francesco Pompo 2025-11-02  50   const u8 *ptr = (u8 *)&ep->int_anchor;
> d45578057224c4 Francesco Pompo 2025-11-02  51   u8 sum = 0;
> d45578057224c4 Francesco Pompo 2025-11-02  52   int i;
> d45578057224c4 Francesco Pompo 2025-11-02  53
> d45578057224c4 Francesco Pompo 2025-11-02  54   for (i = 0; i < 15; i++)
> d45578057224c4 Francesco Pompo 2025-11-02 @55           sum += ptr[i];
>
> This loop reads across a bunch of struct members.  We would normally
> use a struct_group() to say that all the struct members are grouped
> together.
>
> d45578057224c4 Francesco Pompo 2025-11-02  56
> d45578057224c4 Francesco Pompo 2025-11-02  57   return sum == 0;
> d45578057224c4 Francesco Pompo 2025-11-02  58  }
>

Please report issues against the version of the patch that is actually
in -next, rather than random versions from the mailing list.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
  2025-11-06 17:50   ` Ard Biesheuvel
@ 2025-11-06 22:58     ` Philip Li
  0 siblings, 0 replies; 9+ messages in thread
From: Philip Li @ 2025-11-06 22:58 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Dan Carpenter, oe-kbuild, Francesco Pompo, lkp, oe-kbuild-all,
	linux-efi, linux-kernel

On Thu, Nov 06, 2025 at 06:50:12PM +0100, Ard Biesheuvel wrote:
> Hi Dan,
> 
> On Thu, 6 Nov 2025 at 14:08, Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > Hi Francesco,
> >
> > kernel test robot noticed the following build warnings:
> >
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Francesco-Pompo/efistub-smbios-Add-fallback-for-SMBIOS-record-lookup/20251102-081803
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
> > patch link:    https://lore.kernel.org/r/20251102001411.108385-1-francescopompo2%40gmail.com
> > patch subject: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
> > config: i386-randconfig-141-20251103 (https://download.01.org/0day-ci/archive/20251104/202511040131.8yGeRa6u-lkp@intel.com/config)
> > compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > | Closes: https://lore.kernel.org/r/202511040131.8yGeRa6u-lkp@intel.com/
> >
> > smatch warnings:
> > drivers/firmware/efi/libstub/smbios.c:55 verify_ep_int_checksum() error: buffer overflow 'ptr' 5 <= 14
> >
> > vim +/ptr +55 drivers/firmware/efi/libstub/smbios.c
> >
> > d45578057224c4 Francesco Pompo 2025-11-02  48  static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
> > d45578057224c4 Francesco Pompo 2025-11-02  49  {
> > d45578057224c4 Francesco Pompo 2025-11-02  50   const u8 *ptr = (u8 *)&ep->int_anchor;
> > d45578057224c4 Francesco Pompo 2025-11-02  51   u8 sum = 0;
> > d45578057224c4 Francesco Pompo 2025-11-02  52   int i;
> > d45578057224c4 Francesco Pompo 2025-11-02  53
> > d45578057224c4 Francesco Pompo 2025-11-02  54   for (i = 0; i < 15; i++)
> > d45578057224c4 Francesco Pompo 2025-11-02 @55           sum += ptr[i];
> >
> > This loop reads across a bunch of struct members.  We would normally
> > use a struct_group() to say that all the struct members are grouped
> > together.
> >
> > d45578057224c4 Francesco Pompo 2025-11-02  56
> > d45578057224c4 Francesco Pompo 2025-11-02  57   return sum == 0;
> > d45578057224c4 Francesco Pompo 2025-11-02  58  }
> >
> 
> Please report issues against the version of the patch that is actually
> in -next, rather than random versions from the mailing list.

Sorry for this, this is the bot issue, that i will update bot to try to filter
out such patches from mailing list to avoid testing them.

> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-11-06 22:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02  0:13 [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup Francesco Pompo
2025-11-03  8:19 ` Ard Biesheuvel
2025-11-03 10:14   ` Francesco Pompò
2025-11-03 10:41     ` Ard Biesheuvel
2025-11-03 13:11     ` Ard Biesheuvel
2025-11-03 13:14       ` francesco
2025-11-06 13:08 ` Dan Carpenter
2025-11-06 17:50   ` Ard Biesheuvel
2025-11-06 22:58     ` Philip Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).