MIPS: KASLR: Print relocation Information on boot
authorMatt Redfearn <[email protected]>
Thu, 31 Mar 2016 09:05:42 +0000 (10:05 +0100)
committerRalf Baechle <[email protected]>
Fri, 13 May 2016 12:02:04 +0000 (14:02 +0200)
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.

[[email protected]: Fixed spelling mistake pointed out by
Sergei Shtylyov <[email protected]>.]

Signed-off-by: Matt Redfearn <[email protected]>
Cc: Aaro Koskinen <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Alexander Sverdlin <[email protected]>
Cc: Jaedon Shin <[email protected]>
Cc: Jonas Gorski <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/12989/
Signed-off-by: Ralf Baechle <[email protected]>
arch/mips/kernel/setup.c

index 3378fdaf4dd346e674dbfae28b67b0cc75ba940a..9b20a0f89812210afa9fc92d05260186c6e32010 100644 (file)
@@ -477,9 +477,18 @@ static void __init bootmem_init(void)
         */
        if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
                unsigned long offset;
+               extern void show_kernel_relocation(const char *level);
 
                offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
                free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
+
+#if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)
+               /*
+                * This information is necessary when debugging the kernel
+                * But is a security vulnerability otherwise!
+                */
+               show_kernel_relocation(KERN_INFO);
+#endif
        }
 #endif