]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: kaslr: ensure randomized quantities are clean also when kaslr is off
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 27 Jan 2019 08:29:42 +0000 (09:29 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 1 Feb 2019 14:07:23 +0000 (14:07 +0000)
commit50c637b9610b22568aa302a8da27e3f01d659073
treee75c363da6b48053bafc00af07b7b493e703edbd
parent20dd0edc11737ef9b41719d9e9029efa98a5ed98
arm64: kaslr: ensure randomized quantities are clean also when kaslr is off

Commit 0cd987956fba ("arm64: kaslr: ensure randomized quantities are
clean to the PoC") added cache maintenance to ensure that global
variables set by the kaslr init routine are not wiped clean due to
cache invalidation occurring during the second round of page table
creation.

However, if kaslr_early_init() exits early with no randomization
being applied (either due to the lack of a seed, or because the user
has disabled kaslr explicitly), no cache maintenance is performed,
leading to the same issue we attempted to fix earlier, as far as the
module_alloc_base variable is concerned.

Note that module_alloc_base cannot be initialized statically, because
that would cause it to be subject to a R_AARCH64_RELATIVE relocation,
causing it to be overwritten by the second round of KASLR relocation
processing.

Fixes: 3b6fc70b4cce ("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