]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi_loader: Handle GD_FLG_SKIP_RELOC
authorVaradarajan Narayanan <quic_varada@quicinc.com>
Wed, 26 Mar 2025 05:46:53 +0000 (11:16 +0530)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 11 Apr 2025 11:24:06 +0000 (13:24 +0200)
If the EFI runtime services pointers are relocated even though
relocation is skipped, it corrupts some other data resulting in some
unexpected behaviour.

In this specific case, it overwrote some page table entries resulting in
the device memory address range's mappings getting removed. Eventually,
after the completion of efi_runtime_relocate(), when a driver tries to
access its device's registers it crashes since the mappings are absent.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
common/board_r.c

index 8d69db1875d05c6dc57da570bbc753e57e0ce12e..f12e0c848e7eb485bff2dba157af2cf14e924837 100644 (file)
@@ -169,7 +169,8 @@ static int initr_reloc_global_data(void)
         */
        efi_save_gd();
 
-       efi_runtime_relocate(gd->relocaddr, NULL);
+       if (!(gd->flags & GD_FLG_SKIP_RELOC))
+               efi_runtime_relocate(gd->relocaddr, NULL);
 
 #endif
        /*