summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaison Phan <tsphan42@gmail.com>2024-02-06 21:37:47 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-01 10:24:33 +0100
commitaf694bdae717c92e1dc0e9f2e61468099ab74c28 (patch)
tree7b86bfab240534cba0b7d95344e557ae644f6b51
parentc695f0184352e2d1e0b970df40f36510b7e0ed43 (diff)
downloadbarebox-af694bdae717.tar.gz
barebox-af694bdae717.tar.xz
ARM: bootm barebox: page align barebox start address
The aarch64 bootm image handler for barebox can choose a load address that is not 4KB aligned. This can result in unexpected behavior with the ADRP instruction that is available in 64 bit ARM architectures. ADRP forms a PC-relative address to a 4KB page where the bottom 12 bits of the current PC will be masked out. When the load address of the barebox image is not 4KB aligned ADRP can end up forming an address that starts from an invalid page of memory or the wrong page of memory that was expected to be formed. The following patch aligns the load address for the next barebox image to be 4KB aligned to accommodate the ADRP instruction. Link: https://lore.barebox.org/CAFPn3sTc_3q04koG_oPnqTmhGnejxtiva+B5KwYsCdC3czCmKw@mail.gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/lib64/armlinux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/lib64/armlinux.c b/arch/arm/lib64/armlinux.c
index 8382ffdf1b..8b62131347 100644
--- a/arch/arm/lib64/armlinux.c
+++ b/arch/arm/lib64/armlinux.c
@@ -55,7 +55,7 @@ static int do_bootm_barebox(struct image_data *data)
if (ret)
goto out;
- barebox = start;
+ barebox = PAGE_ALIGN(start);
ret = bootm_load_os(data, barebox);
if (ret)