Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501841

[PATCH] MIPS: generic: Fix KASLR for generic kernel.

Path csiph.com!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Matt Redfearn <matt.redfearn@imgtec.com>
Newsgroups linux.kernel
Subject [PATCH] MIPS: generic: Fix KASLR for generic kernel.
Date Mon, 17 Oct 2016 12:10:03 +0200
Message-ID <std1N-26b-63@gated-at.bofh.it> (permalink)
X-Original-To Ralf Baechle <ralf@linux-mips.org>
X-Mailer git-send-email 2.7.4
MIME-Version 1.0
Content-Type text/plain
X-Originating-IP [10.150.130.83]
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 56
Organization linux.* mail to news gateway
X-Original-Cc <linux-mips@linux-mips.org>, Matt Redfearn <matt.redfearn@imgtec.com>, <linux-kernel@vger.kernel.org>, Paul Burton <paul.burton@imgtec.com>
X-Original-Date Mon, 17 Oct 2016 11:05:09 +0100
X-Original-Message-ID <1476698709-6771-1-git-send-email-matt.redfearn@imgtec.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1501841

Show key headers only | View raw


The KASLR code requires that the plat_get_fdt() function return the
address of the device tree, and it must be available early in the boot,
before prom_init() is called. Move the code determining the address of
the device tree into plat_get_fdt, and call that from prom_init().

The fdt pointer will be set up by plat_get_fdt() called from
relocate_kernel initially and once the relocated kernel has started,
prom_init() will use it again to determine the address in the relocated
image.

Fixes: eed0eabd12ef
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---

 arch/mips/generic/init.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 0ea73e845440..d493ccbf274a 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -30,9 +30,19 @@ static __initdata const void *mach_match_data;
 
 void __init prom_init(void)
 {
+	plat_get_fdt();
+	BUG_ON(!fdt);
+}
+
+void __init *plat_get_fdt(void)
+{
 	const struct mips_machine *check_mach;
 	const struct of_device_id *match;
 
+	if (fdt)
+		/* Already set up */
+		return (void *)fdt;
+
 	if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_arg1)) {
 		/*
 		 * We booted using the UHI boot protocol, so we have been
@@ -75,12 +85,6 @@ void __init prom_init(void)
 		/* Retrieve the machine's FDT */
 		fdt = mach->fdt;
 	}
-
-	BUG_ON(!fdt);
-}
-
-void __init *plat_get_fdt(void)
-{
 	return (void *)fdt;
 }
 
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] MIPS: generic: Fix KASLR for generic kernel. Matt Redfearn <matt.redfearn@imgtec.com> - 2016-10-17 12:10 +0200
  Re: [PATCH] MIPS: generic: Fix KASLR for generic kernel. James Hogan <james.hogan@imgtec.com> - 2016-10-17 12:30 +0200
  Re: [PATCH] MIPS: generic: Fix KASLR for generic kernel. Paul Burton <paul.burton@imgtec.com> - 2016-10-17 17:30 +0200

csiph-web