Patchwork [2/2] efi: efi_guid_t must be 64-bit aligned

login
register
mail settings
Submitter Ard Biesheuvel
Date Dec. 17, 2018, 6:02 p.m.
Message ID <20181217180214.9436-3-ard.biesheuvel@linaro.org>
Download mbox | patch
Permalink /patch/684037/
State New
Headers show

Comments

Ard Biesheuvel - Dec. 17, 2018, 6:02 p.m.
From: Heinrich Schuchardt <xypron.glpk@gmx.de>

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.

Note that this could potentially trigger alignment faults during
EFI runtime services calls on 32-bit ARM, given that it does not
permit load/store double or load/store multiple instructions to
operate on memory addresses that are not 32-bit aligned.

Cc: <stable@vger.kernel.org> # v4.9+, or earlier if possible
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 include/linux/efi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Ard Biesheuvel - Dec. 19, 2018, 10:07 a.m.
On Tue, 18 Dec 2018 at 21:41, Sasha Levin <sashal@kernel.org> wrote:
>
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
>
> The bot has tested the following trees: v4.19.10, v4.14.89, v4.9.146, v4.4.168, v3.18.130,
>

Please disregard this patch for -stable until we decide how we are
going to fix the 32-bit array packing issue.


> v4.19.10: Build OK!
> v4.14.89: Build OK!
> v4.9.146: Failed to apply! Possible dependencies:
>     2f74f09bce4f ("efi: parse ARM processor error")
>     5b53696a30d5 ("ACPI / APEI: Switch to use new generic UUID API")
>     bbcc2e7b642e ("ras: acpi/apei: cper: add support for generic data v3 structure")
>     c0020756315e ("efi: switch to use new generic UUID API")
>
> v4.4.168: Failed to apply! Possible dependencies:
>     2c23b73c2d02 ("x86/efi: Prepare GOP handling code for reuse as generic code")
>     2f74f09bce4f ("efi: parse ARM processor error")
>     5b53696a30d5 ("ACPI / APEI: Switch to use new generic UUID API")
>     ba7e34b1bbd2 ("include/linux/efi.h: redefine type, constant, macro from generic code")
>     bbcc2e7b642e ("ras: acpi/apei: cper: add support for generic data v3 structure")
>     c0020756315e ("efi: switch to use new generic UUID API")
>
> v3.18.130: Failed to apply! Possible dependencies:
>     1bd0abb0c924 ("arm64/efi: set EFI_ALLOC_ALIGN to 64 KB")
>     23a0d4e8fa6d ("efi: Disable interrupts around EFI calls, not in the epilog/prolog calls")
>     2c23b73c2d02 ("x86/efi: Prepare GOP handling code for reuse as generic code")
>     2f74f09bce4f ("efi: parse ARM processor error")
>     4c62360d7562 ("efi: Handle memory error structures produced based on old versions of standard")
>     4ee20980812b ("arm64: fix data type for physical address")
>     5b53696a30d5 ("ACPI / APEI: Switch to use new generic UUID API")
>     60305db98845 ("arm64/efi: move virtmap init to early initcall")
>     744937b0b12a ("efi: Clean up the efi_call_phys_[prolog|epilog]() save/restore interaction")
>     790a2ee24278 ("Merge tag 'efi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into core/efi")
>     8a53554e12e9 ("x86/efi: Fix multiple GOP device support")
>     8ce837cee8f5 ("arm64/mm: add create_pgd_mapping() to create private page tables")
>     9679be103108 ("arm64/efi: remove idmap manipulations from UEFI code")
>     a352ea3e197b ("arm64/efi: set PE/COFF file alignment to 512 bytes")
>     b05b9f5f9dcf ("x86, mirror: x86 enabling - find mirrored memory ranges")
>     ba7e34b1bbd2 ("include/linux/efi.h: redefine type, constant, macro from generic code")
>     bbcc2e7b642e ("ras: acpi/apei: cper: add support for generic data v3 structure")
>     c0020756315e ("efi: switch to use new generic UUID API")
>     d1ae8c005792 ("arm64: dmi: Add SMBIOS/DMI support")
>     da141706aea5 ("arm64: add better page protections to arm64")
>     e1e1fddae74b ("arm64/mm: add explicit struct_mm argument to __create_mapping()")
>     ea6bc80d1819 ("arm64/efi: set PE/COFF section alignment to 4 KB")
>     f3cdfd239da5 ("arm64/efi: move SetVirtualAddressMap() to UEFI stub")
>
>
> How should we proceed with this patch?
>
> --
> Thanks,
> Sasha
Sasha Levin - Dec. 19, 2018, 2:06 p.m.
On Wed, Dec 19, 2018 at 11:07:53AM +0100, Ard Biesheuvel wrote:
>On Tue, 18 Dec 2018 at 21:41, Sasha Levin <sashal@kernel.org> wrote:
>>
>> Hi,
>>
>> [This is an automated email]
>>
>> This commit has been processed because it contains a -stable tag.
>> The stable tag indicates that it's relevant for the following trees: all
>>
>> The bot has tested the following trees: v4.19.10, v4.14.89, v4.9.146, v4.4.168, v3.18.130,
>>
>
>Please disregard this patch for -stable until we decide how we are
>going to fix the 32-bit array packing issue.

No worries, we won't take any patches until they are actually upstream.
These mails just help us get more responses with regards to how
backports should be done.

--
Thanks,
Sasha

Patch

diff --git a/include/linux/efi.h b/include/linux/efi.h
index 100ce4a4aff6..e6480c805932 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;
+typedef guid_t efi_guid_t __aligned(8);
 
 #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)