summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaradarajan Narayanan <quic_varada@quicinc.com>2025-03-26 11:16:53 +0530
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-04-11 13:24:06 +0200
commit742aa8b0396dfeb39e60c88988b7db3d9694a09d (patch)
tree40fa29f112b5ee405e07b4a486e7c450a3779fb5
parent85403c46e681653ccc0a31755b51b13c8ac53714 (diff)
efi_loader: Handle GD_FLG_SKIP_RELOC
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>
-rw-r--r--common/board_r.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/board_r.c b/common/board_r.c
index 8d69db1875d..f12e0c848e7 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -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
/*