[kernel] Switch x86-code-dump-fix-truncation.patch to use the pending upstream fix.

Dave Jones davej at fedoraproject.org
Tue Dec 20 00:00:03 UTC 2011


commit 92505b0d0fb617d57f1adc45aa01d0eaeb16c681
Author: Dave Jones <davej at redhat.com>
Date:   Mon Dec 19 18:59:58 2011 -0500

    Switch x86-code-dump-fix-truncation.patch to use the pending upstream fix.

 kernel.spec                        |    3 +
 x86-code-dump-fix-truncation.patch |   77 ++++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 37 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 3a241f5..a001065 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -2231,6 +2231,9 @@ fi
 #                 ||     ||
 %changelog
 * Mon Dec 19 2011 Dave Jones <davej at redhat.com>
+- Switch x86-code-dump-fix-truncation.patch to use the pending upstream fix.
+
+* Mon Dec 19 2011 Dave Jones <davej at redhat.com>
 - Disable IMA. (Forces TPM on, which may be undesirable: See 733964, 746097)
   Move TPM modules to modules-extra
 
diff --git a/x86-code-dump-fix-truncation.patch b/x86-code-dump-fix-truncation.patch
index a20f181..dcd5a81 100644
--- a/x86-code-dump-fix-truncation.patch
+++ b/x86-code-dump-fix-truncation.patch
@@ -1,70 +1,73 @@
-After this patch, kernel code dumps have been sometimes truncated
-in the system log:
+From: Clemens Ladisch <clemens at ladisch.de>
+Date: Mon, 19 Dec 2011 21:07:58 +0000 (+0100)
+Subject: x86, dumpstack: Fix code bytes breakage due to missing KERN_CONT
+X-Git-Url: https://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftip%2Ftip.git;a=commitdiff_plain;h=13f541c10b30fc6529200d7f9a0073217709622f
 
- commit 9d90c8d9cde929cbc575098e825d7c29d9f45054
- "printk: do not mangle valid userspace syslog prefixes"
+x86, dumpstack: Fix code bytes breakage due to missing KERN_CONT
 
-The new code is interpreting the bracketed code byte as a loglevel
-when it happens to have a legal value for that. Fix it by prefixing
-the output with a space.
+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:
 
-Signed-off-by: Chuck Ebbert <cebbert at redhat.com>
+[ 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 at ladisch.de>
+Link: http://lkml.kernel.org/r/4EEFA7AE.9020407@ladisch.de
+Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
 ---
-RHBZ #736815
 
+diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
+index 3b97a80..c99f9ed 100644
 --- a/arch/x86/kernel/dumpstack_32.c
 +++ b/arch/x86/kernel/dumpstack_32.c
-@@ -105,7 +105,7 @@ void show_registers(struct pt_regs *regs
- 		printk(KERN_EMERG "Stack:\n");
- 		show_stack_log_lvl(NULL, regs, &regs->sp, 0, KERN_EMERG);
- 
--		printk(KERN_EMERG "Code: ");
-+		printk(KERN_EMERG "Code:");
- 
- 		ip = (u8 *)regs->ip - code_prologue;
- 		if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
-@@ -116,13 +116,13 @@ void show_registers(struct pt_regs *regs
+@@ -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("  Bad EIP value.");
++				printk(KERN_CONT " Bad EIP value.");
  				break;
  			}
  			if (ip == (u8 *)regs->ip)
 -				printk("<%02x> ", c);
-+				printk(" <%02x>", c);
++				printk(KERN_CONT "<%02x> ", c);
  			else
 -				printk("%02x ", c);
-+				printk(" %02x", c);
++				printk(KERN_CONT "%02x ", c);
  		}
  	}
- 	printk("\n");
+-	printk("\n");
++	printk(KERN_CONT "\n");
+ }
+ 
+ int is_valid_bugaddr(unsigned long ip)
+diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
+index 19853ad..6d728d9 100644
 --- a/arch/x86/kernel/dumpstack_64.c
 +++ b/arch/x86/kernel/dumpstack_64.c
-@@ -273,7 +273,7 @@ void show_registers(struct pt_regs *regs
- 		show_stack_log_lvl(NULL, regs, (unsigned long *)sp,
- 				   0, KERN_EMERG);
- 
--		printk(KERN_EMERG "Code: ");
-+		printk(KERN_EMERG "Code:");
- 
- 		ip = (u8 *)regs->ip - code_prologue;
- 		if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
-@@ -284,13 +284,13 @@ void show_registers(struct pt_regs *regs
+@@ -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("  Bad RIP value.");
++				printk(KERN_CONT " Bad RIP value.");
  				break;
  			}
  			if (ip == (u8 *)regs->ip)
 -				printk("<%02x> ", c);
-+				printk(" <%02x>", c);
++				printk(KERN_CONT "<%02x> ", c);
  			else
 -				printk("%02x ", c);
-+				printk(" %02x", c);
++				printk(KERN_CONT "%02x ", c);
  		}
  	}
- 	printk("\n");
+-	printk("\n");
++	printk(KERN_CONT "\n");
+ }
+ 
+ int is_valid_bugaddr(unsigned long ip)


More information about the scm-commits mailing list