aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
authorMatt Redfearn <matt.redfearn@imgtec.com>2016-03-31 05:05:42 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-05-13 08:02:04 -0400
commit919beb4eedc587b70f8c1390fedac10cda783c36 (patch)
treea99285d59601eb95454271d8fbedeea5e0f2b408 /arch/mips/kernel/setup.c
parent405bc8fd12f59ec865714447b2f6e1a961f49025 (diff)
MIPS: KASLR: Print relocation Information on boot
When debugging a relocated kernel, the addresses of the relocated symbols and the offset applied is essential information. If the kernel is compiled with debugging information, then print this information during bootup using the same function as the panic notifier. [ralf@linux-mips.org: Fixed spelling mistake pointed out by Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>.] Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com> Cc: Aaro Koskinen <aaro.koskinen@nokia.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com> Cc: Jaedon Shin <jaedon.shin@gmail.com> Cc: Jonas Gorski <jogo@openwrt.org> Cc: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Cc: kernel-hardening@lists.openwall.com Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/12989/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 3378fdaf4dd3..9b20a0f89812 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -477,9 +477,18 @@ static void __init bootmem_init(void)
477 */ 477 */
478 if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) { 478 if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
479 unsigned long offset; 479 unsigned long offset;
480 extern void show_kernel_relocation(const char *level);
480 481
481 offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS); 482 offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
482 free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset); 483 free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
484
485#if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)
486 /*
487 * This information is necessary when debugging the kernel
488 * But is a security vulnerability otherwise!
489 */
490 show_kernel_relocation(KERN_INFO);
491#endif
483 } 492 }
484#endif 493#endif
485 494