All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] efi_loader: efi_guid_t must be 64-bit aligned
@ 2018-12-15 21:40 Heinrich Schuchardt
  2018-12-16  9:32 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2018-12-15 21:40 UTC (permalink / raw)
  To: u-boot

The UEFI Specification Version 2.7 Errata A defines:

"EFI_GUID
128-bit buffer containing a unique identifier value.
Unless otherwise specified, aligned on a 64-bit boundary."

Before this patch efi_guid_t was 8-bit aligned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 include/efi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/efi.h b/include/efi.h
index b5e2c64f38b..3018c61b373 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -49,7 +49,7 @@ struct efi_device_path;
 
 typedef struct {
 	u8 b[16];
-} efi_guid_t;
+} efi_guid_t __attribute__ ((aligned (8)));
 
 #define EFI_BITS_PER_LONG	(sizeof(long) * 8)
 
-- 
2.19.2

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

* [U-Boot] [PATCH 1/1] efi_loader: efi_guid_t must be 64-bit aligned
  2018-12-15 21:40 [U-Boot] [PATCH 1/1] efi_loader: efi_guid_t must be 64-bit aligned Heinrich Schuchardt
@ 2018-12-16  9:32 ` Ard Biesheuvel
  2018-12-17 22:45   ` Heinrich Schuchardt
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2018-12-16  9:32 UTC (permalink / raw)
  To: u-boot

On Sat, 15 Dec 2018 at 22:40, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> The UEFI Specification Version 2.7 Errata A defines:
>
> "EFI_GUID
> 128-bit buffer containing a unique identifier value.
> Unless otherwise specified, aligned on a 64-bit boundary."
>
> Before this patch efi_guid_t was 8-bit aligned.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  include/efi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/efi.h b/include/efi.h
> index b5e2c64f38b..3018c61b373 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -49,7 +49,7 @@ struct efi_device_path;
>
>  typedef struct {
>         u8 b[16];
> -} efi_guid_t;
> +} efi_guid_t __attribute__ ((aligned (8)));
>
>  #define EFI_BITS_PER_LONG      (sizeof(long) * 8)
>
> --
> 2.19.2
>

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

* [U-Boot] [PATCH 1/1] efi_loader: efi_guid_t must be 64-bit aligned
  2018-12-16  9:32 ` Ard Biesheuvel
@ 2018-12-17 22:45   ` Heinrich Schuchardt
  0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2018-12-17 22:45 UTC (permalink / raw)
  To: u-boot

On 12/16/18 10:32 AM, Ard Biesheuvel wrote:
> On Sat, 15 Dec 2018 at 22:40, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> The UEFI Specification Version 2.7 Errata A defines:
>>
>> "EFI_GUID
>> 128-bit buffer containing a unique identifier value.
>> Unless otherwise specified, aligned on a 64-bit boundary."
>>
>> Before this patch efi_guid_t was 8-bit aligned.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
>> ---
>>  include/efi.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/efi.h b/include/efi.h
>> index b5e2c64f38b..3018c61b373 100644
>> --- a/include/efi.h
>> +++ b/include/efi.h
>> @@ -49,7 +49,7 @@ struct efi_device_path;
>>
>>  typedef struct {
>>         u8 b[16];
>> -} efi_guid_t;
>> +} efi_guid_t __attribute__ ((aligned (8)));
>>
>>  #define EFI_BITS_PER_LONG      (sizeof(long) * 8)
>>
>> --
>> 2.19.2
>>
> 

Hello Alex,

we should carefully evaluate which side effects this patch has. The
system table contains a link to an array of struct
efi_configuration_table. On 32 bit-systems the patch changes the size of
the entries from 20 to 24 bytes.

So at least this structure we will have to changed to __packed to stay
in sync with GRUB and Linux.

It is unfortunate that the UEFI spec has been written with little detail
on the alignment of structures. Cf. Takahiro's patches concerning the
HII protocols.

Best regards

Heinrich

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

end of thread, other threads:[~2018-12-17 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-15 21:40 [U-Boot] [PATCH 1/1] efi_loader: efi_guid_t must be 64-bit aligned Heinrich Schuchardt
2018-12-16  9:32 ` Ard Biesheuvel
2018-12-17 22:45   ` Heinrich Schuchardt

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.