Dear Vladimir,

On 11.08.23 03:01, Vladimir 'phcoder' Serbinenko wrote:
Le ven. 11 août 2023, 02:17, Pedro Miguel Justo <[email protected] <mailto:[email protected]>> a écrit :

    I have bisected the issue and it resulted into the following change:

    ```
    06edd40db76bb78457ac26156ed5f7b62381bbe8 is the first bad commit
    commit 06edd40db76bb78457ac26156ed5f7b62381bbe8
    Author: Oliver Steffen <[email protected]
    <mailto:[email protected]>>
    Date:   Fri May 26 13:35:43 2023 +0200

         guid: Unify GUID types

         There are 3 implementations of a GUID in GRUB. Replace them with
         a common one, placed in types.h.

         It uses the "packed" flavor of the GUID structs, the alignment
    attribute
         is dropped, since it is not required.

         Signed-off-by: Oliver Steffen <[email protected]
    <mailto:[email protected]>>
         Reviewed-by: Daniel Kiper <[email protected]
    <mailto:[email protected]>>
    ```

    The issue is most likely related with an unaligned memory access
    exception resulting from may global GUID variables being changed
    from `grub_efi_guid_t` (which are decorated with `__attribute__
    ((aligned(8)))`) to the new and unified `grub_guid_t` type (now
    decorated with `__attribute__ ((packed))`).

    Do you concur?

That makes perfect sense. Thank you for the analysis. When passing GUID to EFI we need it to be aligned. I propose to partially revert the commit and keep efi_guid either completely separate or to include common guid type as the only structure in it.

Linux actually uses a minimum alignment of 32 bits, see for example [1].

[1]: https://github.com/torvalds/linux/blob/master/include/linux/efi.h#L60-L78

Would that make sense for GRUB, too?

Cheers,
Frank
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to