x86, dumpstack: Fix code bytes breakage due to missing KERN_CONT
authorClemens Ladisch <clemens@ladisch.de>
Mon, 19 Dec 2011 21:07:58 +0000 (22:07 +0100)
committerH. Peter Anvin <hpa@linux.intel.com>
Mon, 19 Dec 2011 21:09:56 +0000 (13:09 -0800)
When printing the code bytes in show_registers(), the markers around the
byte at the fault address could make the printk() format string look
like a valid log level and facility code.  This would prevent this byte
from being printed and result in a spurious newline:

[ 7555.765589] Code: 8b 32 e9 94 00 00 00 81 7d 00 ff 00 00 00 0f 87 96 00 00 00 48 8b 83 c0 00 00 00 44 89 e2 44 89 e6 48 89 df 48 8b 80 d8 02 00 00
[ 7555.765683]  8b 48 28 48 89 d0 81 e2 ff 0f 00 00 48 c1 e8 0c 48 c1 e0 04

Add KERN_CONT where needed, and elsewhere in show_registers() for
consistency.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Link: http://lkml.kernel.org/r/4EEFA7AE.9020407@ladisch.de
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c

index 3b97a80ce32948ffa995f7b310024f901811703b..c99f9ed013d59985850702a617467b0bf0b556db 100644 (file)
@@ -116,16 +116,16 @@ void show_registers(struct pt_regs *regs)
                for (i = 0; i < code_len; i++, ip++) {
                        if (ip < (u8 *)PAGE_OFFSET ||
                                        probe_kernel_address(ip, c)) {
-                               printk(" Bad EIP value.");
+                               printk(KERN_CONT " Bad EIP value.");
                                break;
                        }
                        if (ip == (u8 *)regs->ip)
-                               printk("<%02x> ", c);
+                               printk(KERN_CONT "<%02x> ", c);
                        else
-                               printk("%02x ", c);
+                               printk(KERN_CONT "%02x ", c);
                }
        }
-       printk("\n");
+       printk(KERN_CONT "\n");
 }
 
 int is_valid_bugaddr(unsigned long ip)
index 19853ad8afc5ff940cbf6806b6ae283695296cd7..6d728d9284bd0e3b94213206bd93af5afbfb7912 100644 (file)
@@ -284,16 +284,16 @@ void show_registers(struct pt_regs *regs)
                for (i = 0; i < code_len; i++, ip++) {
                        if (ip < (u8 *)PAGE_OFFSET ||
                                        probe_kernel_address(ip, c)) {
-                               printk(" Bad RIP value.");
+                               printk(KERN_CONT " Bad RIP value.");
                                break;
                        }
                        if (ip == (u8 *)regs->ip)
-                               printk("<%02x> ", c);
+                               printk(KERN_CONT "<%02x> ", c);
                        else
-                               printk("%02x ", c);
+                               printk(KERN_CONT "%02x ", c);
                }
        }
-       printk("\n");
+       printk(KERN_CONT "\n");
 }
 
 int is_valid_bugaddr(unsigned long ip)