[PATCH 0/2] arm64: restrict initrd placement to guarantee linear region coverage
Ard Biesheuvel
ard.biesheuvel at linaro.org
Wed Mar 30 06:18:41 PDT 2016
Since commit a7f8de168ace ("arm64: allow kernel Image to be loaded anywhere
in physical memory"), we need to take some extra care to ensure that the linear
region covers the kernel image if the [disjoint] placement of system RAM in
the physical address space spans a larger distance than we can cover with the
linear mapping.
A related issue, which is not currently covered, may occur if the kernel Image
is loaded high up in physical memory while the initrd is placed close to the
beginning of memory, in a way that does not allow the linear mapping to cover
both entirely. This will currently go undetected by relocate_initrd(), and will
crash the kernel as soon as it tries to access the initrd contents.
Rather than updating relocate_initrd() to deal with this case as well, this
series replaces it with
a) a new arm64 boot protocol requirement to place the kernel Image and the
initrd within a reasonable distance of each other, so that the linear region
issue described above can no longer occur,
b) code to add back the memory covered by the initrd if it was removed from the
linear region due to a mem= kernel command line parameter, which is the use
case relocate_initrd() was designed to address in the first place.
This way, we can remove relocate_initrd() entirely, and simply rely on the
placement of initrd by the bootloader. The only side effect is that the mem=
limit could be relaxed somewhat (i.e., by the size of the initrd) if the initrd
is placed outside of the memory that is covered by the mem= parameter. This is
entirely under the control of the bootloader, and if this is a concern, the
bootloader should pass mem= and initrd= arguments which are mutually consistent.
Ard Biesheuvel (2):
arm64: add the initrd region to the linear mapping explicitly
arm64: remove the now unneeded relocate_initrd()
Documentation/arm64/booting.txt | 4 ++
arch/arm64/kernel/setup.c | 64 --------------------
arch/arm64/mm/init.c | 29 +++++++++
3 files changed, 33 insertions(+), 64 deletions(-)
--
2.5.0
More information about the linux-arm-kernel
mailing list