efi/arm64: handle missing virtual mapping for UEFI System Table
PATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
If we cannot resolve the virtual address of the UEFI System Table, its physical offset must be missing from the virtual memory map, and there is really no point in proceeding with installing the virtual memory map and the runtime services dispatch table. So back out gracefully.
--- arch/arm64/kernel/efi.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
arch/arm64/kernel/efi.c +24 -4
@@ -414,13 +414,24 @@ static int __init arm64_enter_virtual_mode(void)for_each_efi_memory_desc (&memmap, md) {if (!(md->attribute &EFI_MEMORY_RUNTIME ))continue ; -if (remap_region (md, &virt_md)) - ++count; +if (!remap_region (md, &virt_md)) + goto err_unmap; + ++count; } efi.systab = (__force void *)efi_lookup_mapped_addr (efi_system_table); -if (efi.systab) -set_bit (EFI_SYSTEM_TABLES , &efi.flags); +if (!efi.systab) { +/* +* If we have no virtual mapping for the System Table at this +* point, the memory map doesn't cover the physical offset where +* it resides. This means the System Table will be inaccessible +* to Runtime Services themselves once the virtual mapping is +* installed. +*/ +pr_err ("Failed to remap EFI System Table -- buggy firmware?\n" ); + goto err_unmap; + } +set_bit (EFI_SYSTEM_TABLES , &efi.flags);local_irq_save (flags);cpu_switch_mm (idmap_pg_dir, &init_mm);
@@ -453,5 +464,14 @@ static int __init arm64_enter_virtual_mode(void)set_bit (EFI_RUNTIME_SERVICES , &efi.flags);return 0 ; + +err_unmap: +/* unmap all mappings that succeeded: there are 'count' of those */ +for (virt_md = virtmap; count--; virt_md += memmap.desc_size) { + md = virt_md; +iounmap ((__force void __iomem *)md->virt_addr); + } +kfree (virtmap); +return -1 ; }early_initcall (arm64_enter_virtual_mode);
Signature · 1 line
1.8.3.2
PATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 7 lines · Ard Biesheuvel
If we cannot resolve the virtual address of the UEFI System Table, its physical offset must be missing from the virtual memory map, and there is really no point in proceeding with installing the virtual memory map and the runtime services dispatch table. So back out gracefully.
Signed-off-by Ard Biesheuvel <[email protected]>---
Catalin Marinas
maintainerPATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 10 lines · Mark Salter
Quoted 7 lines · Ard Biesheuvel
If we cannot resolve the virtual address of the UEFI System Table, its physical offset must be missing from the virtual memory map, and there is really no point in proceeding with installing the virtual memory map and the runtime services dispatch table. So back out gracefully.
Signed-off-by Ard Biesheuvel <[email protected]>---
Acked-by Mark Salter <[email protected]>
Thanks. Do I take this patch or Matt already has other EFI patches to push? If the latter:
PATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 10 lines · Catalin Marinas
Quoted 9 lines · Mark Salter
Quoted 7 lines · Ard Biesheuvel
If we cannot resolve the virtual address of the UEFI System Table, its physical offset must be missing from the virtual memory map, and there is really no point in proceeding with installing the virtual memory map and the runtime services dispatch table. So back out gracefully.
Signed-off-by Ard Biesheuvel <[email protected]>---
Quoted 6 lines
Quoted 1 line
Acked-by Mark Salter <[email protected]>Thanks. Do I take this patch or Matt already has other EFI patches to push? If the latter:
Acked-by Catalin Marinas <[email protected]>
Thanks. You can take it for 3.16 if you like, otherwise it is probably better if we ask Matt to take it through his tree with some other stuff we have in flight at the moment.
Signature · 1 line
Ard.
Catalin Marinas
maintainerPATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 13 lines · Ard Biesheuvel
Quoted 12 lines · Catalin Marinas
Quoted 10 lines · Mark Salter
Quoted 7 lines · Ard Biesheuvel
If we cannot resolve the virtual address of the UEFI System Table, its physical offset must be missing from the virtual memory map, and there is really no point in proceeding with installing the virtual memory map and the runtime services dispatch table. So back out gracefully.
Signed-off-by Ard Biesheuvel <[email protected]>---
Acked-by Mark Salter <[email protected]>
Quoted 8 lines
Quoted 4 lines
Thanks. Do I take this patch or Matt already has other EFI patches to push? If the latter:
Acked-by Catalin Marinas <[email protected]>Thanks. You can take it for 3.16 if you like, otherwise it is probably better if we ask Matt to take it through his tree with some other stuff we have in flight at the moment.
OK, I?ll leave it to Matt then together with the other EFI patches he?s already queuing.
Thanks,
Catalin
PATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 3 lines · Catalin Marinas
OK, I?ll leave it to Matt then together with the other EFI patches he?s already queuing.
Thanks guys.
What release are we targetting with this patch? Is it a bug fix for something likely to affect people? Have there been reports of users actually hitting this issue?
We're at -rc4 now, so there's still time for getting bug fixes to Linus but we may start being asked for justification from the tip folks en route to Linus.
If it's just a case of improving the error paths, can it wait until v3.17?
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
PATCH v3 1/1 efi/arm64: handle missing virtual mapping for UEFI System Table
Quoted 11 lines · Matt Fleming
Quoted 3 lines · Catalin Marinas
OK, I?ll leave it to Matt then together with the other EFI patches he?s already queuing.
Thanks guys.
What release are we targetting with this patch? Is it a bug fix for something likely to affect people? Have there been reports of users actually hitting this issue?
Quoted 7 lines
We're at -rc4 now, so there's still time for getting bug fixes to Linus but we may start being asked for justification from the tip folks en route to Linus.
If it's just a case of improving the error paths, can it wait until v3.17?
This fixes a potential panic under buggy firmware, but no reports of this actual bug are known, so there is no justification for a late merge for 3.16.
Thanks,
Ard.
A message that is not in the archive (sent off-list or not yet received): CAKv+Gu9aksvu3kOVt9GAA8jGdR0DkUUJ2iT3RMS-kEZ-OOkH2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 16 lines · Ard Biesheuvel
Quoted 15 lines · Matt Fleming
Quoted 3 lines · Catalin Marinas
OK, I’ll leave it to Matt then together with the other EFI patches he’s already queuing.
Thanks guys.
What release are we targetting with this patch? Is it a bug fix for something likely to affect people? Have there been reports of users actually hitting this issue?
We're at -rc4 now, so there's still time for getting bug fixes to Linus but we may start being asked for justification from the tip folks en route to Linus.
Quoted 8 lines
Quoted 3 lines
If it's just a case of improving the error paths, can it wait until v3.17?
This fixes a potential panic under buggy firmware, but no reports of this actual bug are known, so there is no justification for a late merge for 3.16.
Hey Matt,
I was wondering if you're on track to queue up your -next branch for 3.17?
If so, could you please include $subject? And if you don't mind, could you squash the following fixup into "efi: efistub: Convert into static library" as well?
arch/arm64/kernel/Makefile +1 -2
@@ -4,8 +4,7 @@ CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) -CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ - -I$(src)/../../../scripts/dtc/libfdt +CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_insn.o = -pg
Much appreciated,
Cheers,
Ard.
A message that is not in the archive (sent off-list or not yet received): CAKv+Gu8PW2C3=Y5+fwQbCttLp7S4a=qD5n_CRK-FM9cN84kzOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Matt Fleming
AppliedQuoted 8 lines · Ard Biesheuvel
Hey Matt,
I was wondering if you're on track to queue up your -next branch for 3.17?
If so, could you please include $subject? And if you don't mind, could you squash the following fixup into "efi: efistub: Convert into static library" as well?
Umm, well crap, how did I manage to drop this patch?
I've picked this up now (with all the Acks), thanks. Please could you go through the EFI 'next' branch and just make sure there's nothing missing for v3.17?
I was really hoping to get my queue sent to tip today, but I can always send a second pull if it turns out I did miss something.
Quoted 5 lines
arch/arm64/kernel/Makefile +0
-0
arch/arm64/kernel/Makefile line 10
Quoted 9 lines
arch/arm64/kernel/Makefile +1
-2@@ -4,8 +4,7 @@ CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) -CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ - -I$(src)/../../../scripts/dtc/libfdt +CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_insn.o = -pg
Sure, I've fixed this up.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
A message that is not in the archive (sent off-list or not yet received): 20140718193141.GA27099-HNK1S37rvNbeXh+fF434Mdi2O/[email protected]
Quoted 10 lines · Matt Fleming
Quoted 8 lines · Ard Biesheuvel
Hey Matt,
I was wondering if you're on track to queue up your -next branch for 3.17?
If so, could you please include $subject? And if you don't mind, could you squash the following fixup into "efi: efistub: Convert into static library" as well?
Quoted 6 lines
Umm, well crap, how did I manage to drop this patch?
I've picked this up now (with all the Acks), thanks. Please could you go through the EFI 'next' branch and just make sure there's nothing missing for v3.17?
Thanks, looks lovely. The only thing I notice now is that the commit message from the patch below is missing the second line, which used to read
"#including .c files to building the "
or something to that effect. Obviously, the leading hash sign resulted in this line having been dropped, so this is something that has been in the patches all along.
IMO there is really no point in bothering fixing this, but perhaps your inner grammar nazi disagrees.
Cheers,
Ard.
Quoted 22 lines
I was really hoping to get my queue sent to tip today, but I can always send a second pull if it turns out I did miss something.
Quoted 5 lines
arch/arm64/kernel/Makefile +0
-0arch/arm64/kernel/Makefile line 10
Quoted 9 lines
arch/arm64/kernel/Makefile +1
-2@@ -4,8 +4,7 @@ CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) -CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ - -I$(src)/../../../scripts/dtc/libfdt +CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_insn.o = -pgSure, I've fixed this up.
--
Matt Fleming, Intel Open Source Technology Center
A message that is not in the archive (sent off-list or not yet received): CAKv+Gu-DTRi8Fjv_u_6bHCF1UTKVaok6vy3RjjvBG53Qa5wv3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 10 lines · Ard Biesheuvel
Thanks, looks lovely. The only thing I notice now is that the commit message from the patch below is missing the second line, which used to read
"#including .c files to building the "
or something to that effect. Obviously, the leading hash sign resulted in this line having been dropped, so this is something that has been in the patches all along.
Oops, that's my over-zealous patch munging. Well spotted!
Quoted 2 lines
IMO there is really no point in bothering fixing this, but perhaps your inner grammar nazi disagrees.
He's a tyrant, I fixed it up, mainly because I broke it in the first place.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center