public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel•org>
To: Catalin Marinas <catalin.marinas@arm•com>,
	Will Deacon <will@kernel•org>,
	Mark Rutland <mark.rutland@arm•com>
Cc: Mark Brown <broonie@kernel•org>, linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2 2/2] arm64: kaslr: Check command line before looking for a seed
Date: Fri,  8 Nov 2019 15:46:07 +0000	[thread overview]
Message-ID: <20191108154607.51051-3-broonie@kernel.org> (raw)
In-Reply-To: <20191108154607.51051-1-broonie@kernel.org>

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.

Signed-off-by: Mark Brown <broonie@kernel•org>
---
 arch/arm64/kernel/kaslr.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index 0039dc50e556..cbd481af0c3d 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -104,15 +104,6 @@ u64 __init kaslr_early_init(u64 dt_phys)
 		return 0;
 	}
 
-	/*
-	 * 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
 	 * return 0 if that is the case.
@@ -124,6 +115,15 @@ u64 __init kaslr_early_init(u64 dt_phys)
 		return 0;
 	}
 
+	/*
+	 * Retrieve (and wipe) the seed from the FDT
+	 */
+	seed = get_kaslr_seed(fdt);
+	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
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-11-08 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 15:46 [PATCH v2 0/2] Improve KASLR diagnostics Mark Brown
2019-11-08 15:46 ` [PATCH v2 1/2] arm64: kaslr: Announce KASLR status on boot Mark Brown
2019-11-08 15:46 ` Mark Brown [this message]
2019-11-08 15:50   ` [PATCH v2 2/2] arm64: kaslr: Check command line before looking for a seed Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108154607.51051-3-broonie@kernel.org \
    --to=broonie@kernel$(echo .)org \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=mark.rutland@arm$(echo .)com \
    --cc=will@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox