Commit 13f541c10b30fc6529200d7f9a0073217709622f

Authored by Clemens Ladisch
Committed by H. Peter Anvin
1 parent 384703b8e6

x86, dumpstack: Fix code bytes breakage due to missing KERN_CONT

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>

Showing 2 changed files with 8 additions and 8 deletions Side-by-side Diff

arch/x86/kernel/dumpstack_32.c
... ... @@ -116,16 +116,16 @@
116 116 for (i = 0; i < code_len; i++, ip++) {
117 117 if (ip < (u8 *)PAGE_OFFSET ||
118 118 probe_kernel_address(ip, c)) {
119   - printk(" Bad EIP value.");
  119 + printk(KERN_CONT " Bad EIP value.");
120 120 break;
121 121 }
122 122 if (ip == (u8 *)regs->ip)
123   - printk("<%02x> ", c);
  123 + printk(KERN_CONT "<%02x> ", c);
124 124 else
125   - printk("%02x ", c);
  125 + printk(KERN_CONT "%02x ", c);
126 126 }
127 127 }
128   - printk("\n");
  128 + printk(KERN_CONT "\n");
129 129 }
130 130  
131 131 int is_valid_bugaddr(unsigned long ip)
arch/x86/kernel/dumpstack_64.c
... ... @@ -284,16 +284,16 @@
284 284 for (i = 0; i < code_len; i++, ip++) {
285 285 if (ip < (u8 *)PAGE_OFFSET ||
286 286 probe_kernel_address(ip, c)) {
287   - printk(" Bad RIP value.");
  287 + printk(KERN_CONT " Bad RIP value.");
288 288 break;
289 289 }
290 290 if (ip == (u8 *)regs->ip)
291   - printk("<%02x> ", c);
  291 + printk(KERN_CONT "<%02x> ", c);
292 292 else
293   - printk("%02x ", c);
  293 + printk(KERN_CONT "%02x ", c);
294 294 }
295 295 }
296   - printk("\n");
  296 + printk(KERN_CONT "\n");
297 297 }
298 298  
299 299 int is_valid_bugaddr(unsigned long ip)