* [PATCH] EFI: Fix relocating ESRT for dom0
@ 2026-02-11 0:16 Marek Marczykowski-Górecki
2026-02-11 0:58 ` Andrew Cooper
2026-02-11 14:55 ` Daniel P. Smith
0 siblings, 2 replies; 4+ messages in thread
From: Marek Marczykowski-Górecki @ 2026-02-11 0:16 UTC (permalink / raw)
To: xen-devel; +Cc: Marek Marczykowski-Górecki, Daniel P. Smith, Jan Beulich
Fix calculating the table size - it consists of a header + entries, not
just entries.
This bug caused the last entry to have garbage in its final fields,
including LowestSupportedFwVersion and CapsuleFlags, which (usually)
made fwupd to detect firmware update availability, but refuse actually
installing it.
Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
xen/common/efi/boot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 5b84dbf26e5e..45015a0dd583 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
return 0;
- return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+ return offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) +
+ esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
}
static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] EFI: Fix relocating ESRT for dom0
2026-02-11 0:16 [PATCH] EFI: Fix relocating ESRT for dom0 Marek Marczykowski-Górecki
@ 2026-02-11 0:58 ` Andrew Cooper
2026-02-11 1:16 ` Marek Marczykowski-Górecki
2026-02-11 14:55 ` Daniel P. Smith
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2026-02-11 0:58 UTC (permalink / raw)
To: Marek Marczykowski-Górecki, xen-devel
Cc: Andrew Cooper, Daniel P. Smith, Jan Beulich
On 11/02/2026 12:16 am, Marek Marczykowski-Górecki wrote:
> Fix calculating the table size - it consists of a header + entries, not
> just entries.
> This bug caused the last entry to have garbage in its final fields,
> including LowestSupportedFwVersion and CapsuleFlags, which (usually)
> made fwupd to detect firmware update availability, but refuse actually
"made fwupd able to"
> installing it.
>
> Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> xen/common/efi/boot.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> index 5b84dbf26e5e..45015a0dd583 100644
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
> if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
> return 0;
>
> - return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
> + return offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) +
> + esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries[esrt_ptr->FwResourceCount])
is a shorter expression with the same answer, and a pattern we use
elsewhere. I can fix on commit if you're happy.
~Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] EFI: Fix relocating ESRT for dom0
2026-02-11 0:58 ` Andrew Cooper
@ 2026-02-11 1:16 ` Marek Marczykowski-Górecki
0 siblings, 0 replies; 4+ messages in thread
From: Marek Marczykowski-Górecki @ 2026-02-11 1:16 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel, Daniel P. Smith, Jan Beulich
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
On Wed, Feb 11, 2026 at 12:58:25AM +0000, Andrew Cooper wrote:
> On 11/02/2026 12:16 am, Marek Marczykowski-Górecki wrote:
> > Fix calculating the table size - it consists of a header + entries, not
> > just entries.
> > This bug caused the last entry to have garbage in its final fields,
> > including LowestSupportedFwVersion and CapsuleFlags, which (usually)
> > made fwupd to detect firmware update availability, but refuse actually
>
> "made fwupd able to"
>
> > installing it.
> >
> > Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> > ---
> > xen/common/efi/boot.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> > index 5b84dbf26e5e..45015a0dd583 100644
> > --- a/xen/common/efi/boot.c
> > +++ b/xen/common/efi/boot.c
> > @@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
> > if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
> > return 0;
> >
> > - return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
> > + return offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) +
> > + esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
>
> offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries[esrt_ptr->FwResourceCount])
>
> is a shorter expression with the same answer, and a pattern we use
> elsewhere. I can fix on commit if you're happy.
Fine with me, thanks.
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] EFI: Fix relocating ESRT for dom0
2026-02-11 0:16 [PATCH] EFI: Fix relocating ESRT for dom0 Marek Marczykowski-Górecki
2026-02-11 0:58 ` Andrew Cooper
@ 2026-02-11 14:55 ` Daniel P. Smith
1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Smith @ 2026-02-11 14:55 UTC (permalink / raw)
To: Marek Marczykowski-Górecki, xen-devel; +Cc: Jan Beulich
On February 10, 2026 7:16:42 PM EST, "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com> wrote:
>Fix calculating the table size - it consists of a header + entries, not
>just entries.
>This bug caused the last entry to have garbage in its final fields,
>including LowestSupportedFwVersion and CapsuleFlags, which (usually)
>made fwupd to detect firmware update availability, but refuse actually
>installing it.
>
>Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
>Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
>---
> xen/common/efi/boot.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
>index 5b84dbf26e5e..45015a0dd583 100644
>--- a/xen/common/efi/boot.c
>+++ b/xen/common/efi/boot.c
>@@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
> if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
> return 0;
>
>- return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
>+ return offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) +
>+ esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
> }
>
> static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
With Andy's suggestions,
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-11 15:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 0:16 [PATCH] EFI: Fix relocating ESRT for dom0 Marek Marczykowski-Górecki
2026-02-11 0:58 ` Andrew Cooper
2026-02-11 1:16 ` Marek Marczykowski-Górecki
2026-02-11 14:55 ` Daniel P. Smith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.