[PATCH v10 0/3] ARM: uncompress: Validate start of physical memory against passed DTB

From: Geert Uytterhoeven
Date: Thu Dec 03 2020 - 07:20:19 EST


Hi all,

Currently, the start address of physical memory is obtained by masking
the program counter with a fixed mask of 0xf8000000. This mask value
was chosen as a balance between the requirements of different platforms.
However, this does require that the start address of physical memory is
a multiple of 128 MiB, precluding booting Linux on platforms where this
requirement is not fulfilled.

Fix this limitation by validating the masked address against the memory
information in the passed DTB, to support booting Linux on
r7s9210/rza2mevb using the 64 MiB of SDRAM on the RZA2MEVB sub board,
which is located at 0x0C000000 (CS3 space), i.e. not at a multiple of
128 MiB.

Compared to v9[*], the major change is a step back, and only supporting
this on modern systems that pass the DTB explicitly, with improved
validation to avoid regressions.

This has been regression-tested on a variety of boards using a passed or
appended DTB.

Thanks for your comments!

[*] "[PATCH v9] ARM: boot: Validate start of physical memory against DTB"
(https://lore.kernel.org/r/20200902153606.13652-1-geert+renesas@xxxxxxxxx)

Geert Uytterhoeven (3):
ARM: uncompress: Add be32tocpu macro
ARM: uncompress: Add OF_DT_MAGIC macro
ARM: uncompress: Validate start of physical memory against passed DTB

arch/arm/Kconfig | 7 +-
arch/arm/boot/compressed/Makefile | 5 +-
.../arm/boot/compressed/fdt_check_mem_start.c | 131 ++++++++++++++++++
arch/arm/boot/compressed/head.S | 70 +++++++---
4 files changed, 187 insertions(+), 26 deletions(-)
create mode 100644 arch/arm/boot/compressed/fdt_check_mem_start.c

--
2.25.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds