linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Chuck Ebbert <cebbert@redhat.com>, Andi Kleen <ak@suse.de>,
	patches@x86-64.org, linux-kernel@vger.kernel.org
Subject: [PATCH x86 for review III] [11/29] i386: add option to show more code in oops reports
Date: Mon, 12 Feb 2007 17:51:31 +0100 (CET)	[thread overview]
Message-ID: <20070212165131.56C0313F45@wotan.suse.de> (raw)
In-Reply-To: <20070212551.664370000@suse.de>


From: Chuck Ebbert <cebbert@redhat.com>

Sometimes developers need to see more object code in an oops report,
e.g. when kernel may be corrupted at runtime.

Add the "code_bytes" option for this.

Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 Documentation/kernel-parameters.txt |    5 +++++
 arch/i386/kernel/traps.c            |   20 ++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt
+++ linux/Documentation/kernel-parameters.txt
@@ -364,6 +364,11 @@ and is between 256 and 4096 characters. 
 			clocksource is not available, it defaults to PIT.
 			Format: { pit | tsc | cyclone | pmtmr }
 
+	code_bytes	[IA32] How many bytes of object code to print in an
+			oops report.
+			Range: 0 - 8192
+			Default: 64
+
 	disable_8254_timer
 	enable_8254_timer
 			[IA32/X86_64] Disable/Enable interrupt 0 timer routing
Index: linux/arch/i386/kernel/traps.c
===================================================================
--- linux.orig/arch/i386/kernel/traps.c
+++ linux/arch/i386/kernel/traps.c
@@ -94,6 +94,7 @@ asmlinkage void spurious_interrupt_bug(v
 asmlinkage void machine_check(void);
 
 int kstack_depth_to_print = 24;
+static unsigned int code_bytes = 64;
 ATOMIC_NOTIFIER_HEAD(i386die_chain);
 
 int register_die_notifier(struct notifier_block *nb)
@@ -325,7 +326,8 @@ void show_registers(struct pt_regs *regs
 	 */
 	if (in_kernel) {
 		u8 *eip;
-		int code_bytes = 64;
+		unsigned int code_prologue = code_bytes * 43 / 64;
+		unsigned int code_len = code_bytes;
 		unsigned char c;
 
 		printk("\n" KERN_EMERG "Stack: ");
@@ -333,14 +335,14 @@ void show_registers(struct pt_regs *regs
 
 		printk(KERN_EMERG "Code: ");
 
-		eip = (u8 *)regs->eip - 43;
+		eip = (u8 *)regs->eip - code_prologue;
 		if (eip < (u8 *)PAGE_OFFSET ||
 			probe_kernel_address(eip, c)) {
 			/* try starting at EIP */
 			eip = (u8 *)regs->eip;
-			code_bytes = 32;
+			code_len = code_len - code_prologue + 1;
 		}
-		for (i = 0; i < code_bytes; i++, eip++) {
+		for (i = 0; i < code_len; i++, eip++) {
 			if (eip < (u8 *)PAGE_OFFSET ||
 				probe_kernel_address(eip, c)) {
 				printk(" Bad EIP value.");
@@ -1190,3 +1192,13 @@ static int __init kstack_setup(char *s)
 	return 1;
 }
 __setup("kstack=", kstack_setup);
+
+static int __init code_bytes_setup(char *s)
+{
+	code_bytes = simple_strtoul(s, NULL, 0);
+	if (code_bytes > 8192)
+		code_bytes = 8192;
+
+	return 1;
+}
+__setup("code_bytes=", code_bytes_setup);

  parent reply	other threads:[~2007-02-12 16:55 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 16:51 [PATCH x86 for review III] [1/29] i386: avoid gcc extension Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [2/29] i386: support Classic MediaGXm Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [3/29] i386: entry.S END/ENDPROC annotations Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [4/29] x86_64: clean up sparsemem memory_present call Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [5/29] i386: arch/i386/kernel/alternative.c should #include <asm/bugs.h> Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [6/29] i386: Remove unused kernel config option X86_XADD Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [7/29] x86_64: update IO-APIC dest field to 8-bit for xAPIC Andi Kleen
2007-02-12 19:49   ` Eric W. Biederman
2007-02-12 16:51 ` [PATCH x86 for review III] [8/29] x86_64: avoid warning message livelock Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [9/29] x86_64: Minor patch for compilation warning in x86_64 signal code Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [10/29] i386: don't include bugs.h Andi Kleen
2007-02-12 17:35   ` Jörn Engel
2007-02-12 18:33     ` Andi Kleen
2007-02-12 16:51 ` Andi Kleen [this message]
2007-02-12 16:51 ` [PATCH x86 for review III] [12/29] x86_64: 32-bit ptrace mangles sixth system call argument Andi Kleen
2007-02-12 22:04   ` Chuck Ebbert
2007-02-12 22:26     ` Andi Kleen
2007-02-14 17:52     ` Jeff Dike
2007-02-12 16:51 ` [PATCH x86 for review III] [13/29] i386: geode configuration fixes Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [15/29] x86_64: Fix wrong gcc check in bitops.h Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [16/29] i386: Remove fastcall in paravirt.[ch] Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo Andi Kleen
2007-02-12 22:11   ` Chuck Ebbert
2007-02-12 22:23     ` Andi Kleen
2007-02-12 22:37       ` Chuck Ebbert
2007-02-12 22:38         ` Andi Kleen
2007-02-12 23:04           ` Chuck Ebbert
2007-02-12 16:51 ` [PATCH x86 for review III] [18/29] i386: Add L3 cache support to AMD CPUID4 emulation Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [19/29] x86: Enable NMI watchdog for AMD Family 0x10 CPUs Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [20/29] i386: Fix warning in microcode.c Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [21/29] i386: Fix warning in cpu initialization Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [23/29] x86: Don't require the vDSO for handling a.out signals Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [24/29] x86_64: -mm merge plans for 2.6.21 Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [25/29] i386: paravirt unhandled fallthrough Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [26/29] i386: Move mce_disabled to asm/mce.h Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [27/29] i386: Rename cpu_gdt_descr and remove extern declaration from smpboot.c Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [28/29] i386: Remove extern declaration from mm/discontig.c, put in header Andi Kleen
2007-02-12 16:51 ` [PATCH x86 for review III] [29/29] x86: Unify pcspeaker platform device code between i386/x86-64 Andi Kleen
2007-02-12 19:43 ` [PATCH x86 for review III] [1/29] i386: avoid gcc extension Jochen Voß
2007-02-12 20:18   ` Randy Dunlap
2007-02-13 15:11 ` Arnd Bergmann
2007-02-13 16:10   ` Randy Dunlap
2007-02-13 16:52     ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070212165131.56C0313F45@wotan.suse.de \
    --to=ak@suse.de \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@x86-64.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).