Patchwork [efi-urgent] Revert "efi: Align 'efi_guid_t' to 64 bits"

login
register
mail settings
Submitter Ard Biesheuvel
Date Dec. 21, 2018, 11:54 a.m.
Message ID <20181221115446.2670-1-ard.biesheuvel@linaro.org>
Download mbox | patch
Permalink /patch/688465/
State New
Headers show

Comments

Ard Biesheuvel - Dec. 21, 2018, 11:54 a.m.
This reverts commit 793423cf07e51e3185b8680167115813589c057d.

The 64-bit alignment affects the size of efi_config_table_32_t,
which is used as an array type. On the other hand, the former
byte alignment could trigger alignment faults during firmware
calls on 32-bit ARM, since UEFI defines efi_guid_t as a struct
of UINT32 + UINT16 + UINT16 + UINT8[8], and so it may use load/
store multiple instructions [requiring 32-bit alignment], e.g.,
on GUID pointers passed as function arguments since UEFI's view
of the type has implicit 32-bit alignment.

Let's sort this out for the next release, and revert the change
for now.

Fixes: 793423cf07e5 ("efi: Align 'efi_guid_t' to 64 bits")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Qian Cai <cai@gmx.us>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 include/linux/efi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Borislav Petkov - Dec. 21, 2018, 12:13 p.m.
On Fri, Dec 21, 2018 at 12:54:46PM +0100, Ard Biesheuvel wrote:
> This reverts commit 793423cf07e51e3185b8680167115813589c057d.
> 
> The 64-bit alignment affects the size of efi_config_table_32_t,
> which is used as an array type. On the other hand, the former
> byte alignment could trigger alignment faults during firmware
> calls on 32-bit ARM, since UEFI defines efi_guid_t as a struct
> of UINT32 + UINT16 + UINT16 + UINT8[8], and so it may use load/
> store multiple instructions [requiring 32-bit alignment], e.g.,
> on GUID pointers passed as function arguments since UEFI's view
> of the type has implicit 32-bit alignment.
> 
> Let's sort this out for the next release, and revert the change
> for now.
> 
> Fixes: 793423cf07e5 ("efi: Align 'efi_guid_t' to 64 bits")
> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Qian Cai <cai@gmx.us>
> Cc: Rik van Riel <riel@surriel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  include/linux/efi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index e6480c805932..100ce4a4aff6 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -48,7 +48,7 @@ typedef u16 efi_char16_t;		/* UNICODE character */
>  typedef u64 efi_physical_addr_t;
>  typedef void *efi_handle_t;
>  
> -typedef guid_t efi_guid_t __aligned(8);
> +typedef guid_t efi_guid_t;
>  
>  #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
>  	GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
> -- 

It was the top commit on tip:efi/urgent so I've zapped it.

HTH.
Ard Biesheuvel - Dec. 21, 2018, 12:16 p.m.
On Fri, 21 Dec 2018 at 13:13, Borislav Petkov <bp@alien8.de> wrote:
>
> On Fri, Dec 21, 2018 at 12:54:46PM +0100, Ard Biesheuvel wrote:
> > This reverts commit 793423cf07e51e3185b8680167115813589c057d.
> >
> > The 64-bit alignment affects the size of efi_config_table_32_t,
> > which is used as an array type. On the other hand, the former
> > byte alignment could trigger alignment faults during firmware
> > calls on 32-bit ARM, since UEFI defines efi_guid_t as a struct
> > of UINT32 + UINT16 + UINT16 + UINT8[8], and so it may use load/
> > store multiple instructions [requiring 32-bit alignment], e.g.,
> > on GUID pointers passed as function arguments since UEFI's view
> > of the type has implicit 32-bit alignment.
> >
> > Let's sort this out for the next release, and revert the change
> > for now.
> >
> > Fixes: 793423cf07e5 ("efi: Align 'efi_guid_t' to 64 bits")
> > Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: Borislav Petkov <bp@alien8.de>
> > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Qian Cai <cai@gmx.us>
> > Cc: Rik van Riel <riel@surriel.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> >  include/linux/efi.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/efi.h b/include/linux/efi.h
> > index e6480c805932..100ce4a4aff6 100644
> > --- a/include/linux/efi.h
> > +++ b/include/linux/efi.h
> > @@ -48,7 +48,7 @@ typedef u16 efi_char16_t;           /* UNICODE character */
> >  typedef u64 efi_physical_addr_t;
> >  typedef void *efi_handle_t;
> >
> > -typedef guid_t efi_guid_t __aligned(8);
> > +typedef guid_t efi_guid_t;
> >
> >  #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
> >       GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
> > --
>
> It was the top commit on tip:efi/urgent so I've zapped it.
>

Even better!

Thanks a lot

Patch

diff --git a/include/linux/efi.h b/include/linux/efi.h
index e6480c805932..100ce4a4aff6 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -48,7 +48,7 @@  typedef u16 efi_char16_t;		/* UNICODE character */
 typedef u64 efi_physical_addr_t;
 typedef void *efi_handle_t;
 
-typedef guid_t efi_guid_t __aligned(8);
+typedef guid_t efi_guid_t;
 
 #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
 	GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)