[COMMON] arm64: kernel: fix show data with regs
authorHosung Kim <hosung0.kim@samsung.com>
Mon, 29 May 2017 06:51:50 +0000 (15:51 +0900)
committerYoungmin Nam <youngmin.nam@samsung.com>
Fri, 29 Jun 2018 09:17:30 +0000 (18:17 +0900)
This commit fix the situation that it couldn't output register
informatio which is located in vmalloc address because of
kaslr enable. KASLR is the default after 4.6 kernel of arm64.

Change-Id: Ied75938e89d31d1e6386ac88e5e4d9a97f1159e4
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
arch/arm64/kernel/process.c

index 3f25b930d94a6f28a78b92a6b548239ed8745971..bce35420aad0416f6afaf04ee73080dcbcc8215a 100644 (file)
@@ -188,8 +188,19 @@ static void show_data(unsigned long addr, int nbytes, const char *name)
         * don't attempt to dump non-kernel addresses or
         * values that are probably just small negative numbers
         */
-       if (addr < PAGE_OFFSET || addr > -256UL)
-               return;
+       if (addr < PAGE_OFFSET || addr > -256UL) {
+               /*
+                * If kaslr is enabled, Kernel code is able to
+                * locate in VMALLOC address.
+                */
+               if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
+                       if (addr < (unsigned long)KERNEL_START ||
+                           addr > (unsigned long)KERNEL_END)
+                               return;
+               } else {
+                       return;
+               }
+       }
 
        printk("\n%s: %#lx:\n", name, addr);