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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jan 2019 07:09:49 +0000 (08:09 +0100)
commitee624c01973b4cbc56eecac96bf1a72790d3addf
treef292a4981c9f6d569bc43309062a636ea3d1a4b4
parent96188b18861a78efb40d390931cbe8d938d6a3cb
arm64: kaslr: ensure randomized quantities are clean to the PoC

commit 1598ecda7b239e9232dda032bfddeed9d89fab6c upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/kaslr.c