arm64: kaslr: ensure randomized quantities are clean to the PoC
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 15 Jan 2019 19:47:07 +0000 (20:47 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 16 Jan 2019 12:00:46 +0000 (12:00 +0000)
commit1598ecda7b239e9232dda032bfddeed9d89fab6c
tree78c54037deb5db99e883d9981562b3c4b140bd5d
parent2f97967503df8e45bc256a348b6f050abd2a38ed
arm64: kaslr: ensure randomized quantities are clean to the PoC

kaslr_early_init() is called with the kernel mapped at its
link time offset, and if it returns with a non-zero offset,
the kernel is unmapped and remapped again at the randomized
offset.

During its execution, kaslr_early_init() also randomizes the
base of the module region and of the linear mapping of DRAM,
and sets two variables accordingly. However, since these
variables are assigned with the caches on, they may get lost
during the cache maintenance that occurs when unmapping and
remapping the kernel, so ensure that these values are cleaned
to the PoC.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR")
Cc: <stable@vger.kernel.org> # v4.6+
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/kaslr.c