[PATCH] lib/efi_loader: fix ABI in efi_mm_communicate_header

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] lib/efi_loader: fix ABI in efi_mm_communicate_header

Etienne Carriere
Pack struct efi_mm_communicate_header as done in EDK2 as seen in
release 201808 [1]. If not packed sizeof() for the structure adds
4 additional bytes on 32bit targets which breaks the ABI.

Link: [1] https://github.com/tianocore/edk2/blob/edk2-stable201808/MdePkg/Include/Protocol/MmCommunication.h#L21
Fixes: 23a397d2e2fb ("efi_loader: Add headers for EDK2 StandAloneMM communication")
Signed-off-by: Etienne Carriere <[hidden email]>
---
 include/mm_communication.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/mm_communication.h b/include/mm_communication.h
index e464cbb48e..e65fbde60d 100644
--- a/include/mm_communication.h
+++ b/include/mm_communication.h
@@ -43,7 +43,7 @@
  * To avoid confusion in interpreting frames, the communication buffer should
  * always begin with efi_mm_communicate_header.
  */
-struct efi_mm_communicate_header {
+struct __packed efi_mm_communicate_header {
  efi_guid_t header_guid;
  size_t     message_len;
  u8         data[];
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] lib/efi_loader: fix ABI in efi_mm_communicate_header

Ilias Apalodimas
Thanks Etienne!

On Sat, 21 Nov 2020 at 13:00, Etienne Carriere
<[hidden email]> wrote:

>
> Pack struct efi_mm_communicate_header as done in EDK2 as seen in
> release 201808 [1]. If not packed sizeof() for the structure adds
> 4 additional bytes on 32bit targets which breaks the ABI.
>
> Link: [1] https://github.com/tianocore/edk2/blob/edk2-stable201808/MdePkg/Include/Protocol/MmCommunication.h#L21
> Fixes: 23a397d2e2fb ("efi_loader: Add headers for EDK2 StandAloneMM communication")
> Signed-off-by: Etienne Carriere <[hidden email]>
> ---
>  include/mm_communication.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/mm_communication.h b/include/mm_communication.h
> index e464cbb48e..e65fbde60d 100644
> --- a/include/mm_communication.h
> +++ b/include/mm_communication.h
> @@ -43,7 +43,7 @@
>   * To avoid confusion in interpreting frames, the communication buffer should
>   * always begin with efi_mm_communicate_header.
>   */
> -struct efi_mm_communicate_header {
> +struct __packed efi_mm_communicate_header {
>         efi_guid_t header_guid;
>         size_t     message_len;
>         u8         data[];
> --
> 2.17.1


 Reviewed-by: Ilias Apalodimas <[hidden email]>