summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-01-27 09:29:42 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-06 17:31:34 +0100
commitab4ece4e9b1302bfb8453aa4fe4b2a3388bf476f (patch)
treec2be99237d84f76c67ef2a56ec6b164761ca8efa
parent17aa9d04ba62be77b4aa2be7fa86e1b1dded4cad (diff)
downloadlinux-rpi3-ab4ece4e9b1302bfb8453aa4fe4b2a3388bf476f.tar.gz
linux-rpi3-ab4ece4e9b1302bfb8453aa4fe4b2a3388bf476f.tar.bz2
linux-rpi3-ab4ece4e9b1302bfb8453aa4fe4b2a3388bf476f.zip
arm64: kaslr: ensure randomized quantities are clean also when kaslr is off
commit 8ea235932314311f15ea6cf65c1393ed7e31af70 upstream. Commit 1598ecda7b23 ("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: 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>
-rw-r--r--arch/arm64/kernel/kaslr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index 2bda224e8e71..ae7278286094 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -88,6 +88,7 @@ u64 __init kaslr_early_init(u64 dt_phys)
* we end up running with module randomization disabled.
*/
module_alloc_base = (u64)_etext - MODULES_VSIZE;
+ __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base));
/*
* Try to map the FDT early. If this fails, we simply bail,