]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: head: Ignore bogus KASLR displacement on non-relocatable kernels
authorArd Biesheuvel <ardb@kernel.org>
Sat, 27 Aug 2022 07:09:04 +0000 (09:09 +0200)
committerWill Deacon <will@kernel.org>
Thu, 1 Sep 2022 10:50:44 +0000 (11:50 +0100)
commit9b7dcd3f96b7de11d09fb2efb12dca48cc486733
treeb78e943085a33ae3fe6ed8d7b27f61a587a98980
parent38e96957ee8dfbd7a350c77d703b5affa0762df4
arm64: head: Ignore bogus KASLR displacement on non-relocatable kernels

Even non-KASLR kernels can be built as relocatable, to work around
broken bootloaders that violate the rules regarding physical placement
of the kernel image - in this case, the physical offset modulo 2 MiB is
used as the KASLR offset, and all absolute symbol references are fixed
up in the usual way. This workaround is enabled by default.

CONFIG_RELOCATABLE can also be disabled entirely, in which case the
relocation code and the code that captures the offset are omitted from
the build. However, since commit f1233e1f9c35 ("arm64: head: avoid
relocating the kernel twice for KASLR"), this code got out of sync, and
we still add the offset to the kernel virtual address before populating
the page tables even though we never capture it. This means we add a
bogus value instead, breaking the boot entirely.

Fixes: f1233e1f9c35 ("arm64: head: avoid relocating the kernel twice for KASLR")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Mikulas Patocka <mpatocka@redhat.com>
Link: https://lore.kernel.org/r/20220827070904.2216989-1-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/head.S