[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.9] x86/efi: don't write relocations in efi_arch_relocate_image() first pass



commit e7703a2e86f9002b414b6b6138c2f649af3224bc
Author:     David Woodhouse <dwmw@xxxxxxxxxxxx>
AuthorDate: Fri Oct 6 14:53:51 2017 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Oct 6 14:53:51 2017 +0200

    x86/efi: don't write relocations in efi_arch_relocate_image() first pass
    
    The function is invoked with delta=0 before ExitBootServices() is called,
    as a dummy run purely to validate that all the relocations can be handled.
    This allows us to exit gracefully with an error message.
    
    However, we have relocations in read-only sections such as .rodata and
    .init.te(xt). Recent versions of UEFI will actually make those sections
    read-only, which will cause a fault. This functionaity was added in
    EDK2 commit d0e92aad4 ("MdeModulePkg/DxeCore: Add UEFI image protection.")
    
    It's OK to actually make the changes in the later pass because UEFI will
    tear down the protection when ExitBootServices() is called, because it
    knows we're going to need to do this kind of thing.
    
    Reported-by: Jan Beulich <jbeulich@xxxxxxxx>
    Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
    master commit: 34828425d36b560adfe96430b9b83dfb0f66f2a8
    master date: 2017-08-25 14:07:40 +0200
---
 xen/arch/x86/efi/efi-boot.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 34537d4..16e3214 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -87,7 +87,8 @@ static void __init efi_arch_relocate_image(unsigned long 
delta)
             case PE_BASE_RELOC_DIR64:
                 if ( in_page_tables(addr) )
                     blexit(L"Unexpected relocation type");
-                *(u64 *)addr += delta;
+                if ( delta )
+                    *(u64 *)addr += delta;
                 break;
             default:
                 blexit(L"Unsupported relocation type");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.