summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-11-08 17:12:44 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2019-11-08 17:36:51 +0000
commit2203e1adb936a92ab2fd8f705e888af322462736 (patch)
tree8521c7cece19c9912c4ad7364fd4e05ac6b479a2 /arch/arm64
parent294a9ddde6cdbf931a28b8c8c928d3f799b61cb5 (diff)
downloadblackbird-op-linux-2203e1adb936a92ab2fd8f705e888af322462736.tar.gz
blackbird-op-linux-2203e1adb936a92ab2fd8f705e888af322462736.zip
arm64: kaslr: Check command line before looking for a seed
Now that we print diagnostics at boot the reason why we do not initialise KASLR matters. Currently we check for a seed before we check if the user has explicitly disabled KASLR on the command line which will result in misleading diagnostics so reverse the order of those checks. We still parse the seed from the DT early so that if the user has both provided a seed and disabled KASLR on the command line we still mask the seed on the command line. Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kernel/kaslr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index 0039dc50e556..2a11a962e571 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -26,7 +26,7 @@ enum kaslr_status {
KASLR_DISABLED_FDT_REMAP,
};
-enum kaslr_status __ro_after_init kaslr_status;
+static enum kaslr_status __initdata kaslr_status;
u64 __ro_after_init module_alloc_base;
u16 __initdata memstart_offset_seed;
@@ -108,10 +108,6 @@ u64 __init kaslr_early_init(u64 dt_phys)
* Retrieve (and wipe) the seed from the FDT
*/
seed = get_kaslr_seed(fdt);
- if (!seed) {
- kaslr_status = KASLR_DISABLED_NO_SEED;
- return 0;
- }
/*
* Check if 'nokaslr' appears on the command line, and
@@ -124,6 +120,11 @@ u64 __init kaslr_early_init(u64 dt_phys)
return 0;
}
+ if (!seed) {
+ kaslr_status = KASLR_DISABLED_NO_SEED;
+ return 0;
+ }
+
/*
* OK, so we are proceeding with KASLR enabled. Calculate a suitable
* kernel image offset from the seed. Let's place the kernel in the
OpenPOWER on IntegriCloud