* [patch] i386: show_registers(): try harder to print failing code
@ 2006-07-18 18:22 Chuck Ebbert
2006-07-18 22:12 ` Jesper Juhl
0 siblings, 1 reply; 5+ messages in thread
From: Chuck Ebbert @ 2006-07-18 18:22 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Linus Torvalds, Andi Kleen
show_registers() tries to dump failing code starting 43 bytes
before the offending instruction, but this address can be bad,
for example in a device driver where the failing instruction is
less than 43 bytes from the start of the driver's code. When that
happens, try to dump code starting at the failing instruction
instead of printing no code at all.
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
--- 2.6.18-rc1-32.orig/arch/i386/kernel/traps.c
+++ 2.6.18-rc1-32/arch/i386/kernel/traps.c
@@ -307,6 +307,8 @@ void show_registers(struct pt_regs *regs
*/
if (in_kernel) {
u8 __user *eip;
+ int code_bytes = 64;
+ unsigned char c;
printk("\n" KERN_EMERG "Stack: ");
show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG);
@@ -314,9 +316,12 @@ void show_registers(struct pt_regs *regs
printk(KERN_EMERG "Code: ");
eip = (u8 __user *)regs->eip - 43;
- for (i = 0; i < 64; i++, eip++) {
- unsigned char c;
-
+ if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
+ /* try starting at EIP */
+ eip = (u8 __user *)regs->eip;
+ code_bytes = 32;
+ }
+ for (i = 0; i < code_bytes; i++, eip++) {
if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
printk(" Bad EIP value.");
break;
--
Chuck
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] i386: show_registers(): try harder to print failing code
2006-07-18 18:22 [patch] i386: show_registers(): try harder to print failing code Chuck Ebbert
@ 2006-07-18 22:12 ` Jesper Juhl
2006-07-19 5:33 ` Keith Owens
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Juhl @ 2006-07-18 22:12 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: linux-kernel, Andrew Morton, Linus Torvalds, Andi Kleen
On 18/07/06, Chuck Ebbert <76306.1226@compuserve.com> wrote:
> show_registers() tries to dump failing code starting 43 bytes
> before the offending instruction, but this address can be bad,
> for example in a device driver where the failing instruction is
> less than 43 bytes from the start of the driver's code. When that
> happens, try to dump code starting at the failing instruction
> instead of printing no code at all.
>
Shouldn't the kernel be printing some info noting that this fallback
is in use then? Or will that be completely obvious and I'm just not
able to see that?
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] i386: show_registers(): try harder to print failing code
2006-07-18 22:12 ` Jesper Juhl
@ 2006-07-19 5:33 ` Keith Owens
0 siblings, 0 replies; 5+ messages in thread
From: Keith Owens @ 2006-07-19 5:33 UTC (permalink / raw)
To: Jesper Juhl
Cc: Chuck Ebbert, linux-kernel, Andrew Morton, Linus Torvalds, Andi Kleen
"Jesper Juhl" (on Wed, 19 Jul 2006 00:12:32 +0200) wrote:
>On 18/07/06, Chuck Ebbert <76306.1226@compuserve.com> wrote:
>> show_registers() tries to dump failing code starting 43 bytes
>> before the offending instruction, but this address can be bad,
>> for example in a device driver where the failing instruction is
>> less than 43 bytes from the start of the driver's code. When that
>> happens, try to dump code starting at the failing instruction
>> instead of printing no code at all.
>>
>Shouldn't the kernel be printing some info noting that this fallback
>is in use then? Or will that be completely obvious and I'm just not
>able to see that?
The instruction at the EIP is bracketed, which makes it obvious if you
got any preceding instructions or not.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] i386: show_registers(): try harder to print failing code
2006-07-19 0:25 Chuck Ebbert
@ 2006-07-19 8:59 ` Jesper Juhl
0 siblings, 0 replies; 5+ messages in thread
From: Jesper Juhl @ 2006-07-19 8:59 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: Andi Kleen, Linus Torvalds, Andrew Morton, linux-kernel
On 19/07/06, Chuck Ebbert <76306.1226@compuserve.com> wrote:
> In-Reply-To: <9a8748490607181512t11e9970eu1a7aa1ad1644ec54@mail.gmail.com>
>
> On Wed, 19 Jul 2006 00:12:32 +0200, Jesper Juhl wrote:
> >
> > > show_registers() tries to dump failing code starting 43 bytes
> > > before the offending instruction, but this address can be bad,
> > > for example in a device driver where the failing instruction is
> > > less than 43 bytes from the start of the driver's code. When that
> > > happens, try to dump code starting at the failing instruction
> > > instead of printing no code at all.
> > >
> > Shouldn't the kernel be printing some info noting that this fallback
> > is in use then? Or will that be completely obvious and I'm just not
> > able to see that?
>
> The code byte at EIP is marked with '<>', so it's obvious:
>
> Code: <a1> 00 00 00 00 c7 04 24 05 30 b5 de 89 44 24 04 e8 f5 6f 5c e1 c9 31 c0 c3 00 00 00 00 00 00 00
>
Ahh, ok. I was not aware of that. Thank you for the info.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] i386: show_registers(): try harder to print failing code
@ 2006-07-19 0:25 Chuck Ebbert
2006-07-19 8:59 ` Jesper Juhl
0 siblings, 1 reply; 5+ messages in thread
From: Chuck Ebbert @ 2006-07-19 0:25 UTC (permalink / raw)
To: Jesper Juhl; +Cc: Andi Kleen, Linus Torvalds, Andrew Morton, linux-kernel
In-Reply-To: <9a8748490607181512t11e9970eu1a7aa1ad1644ec54@mail.gmail.com>
On Wed, 19 Jul 2006 00:12:32 +0200, Jesper Juhl wrote:
>
> > show_registers() tries to dump failing code starting 43 bytes
> > before the offending instruction, but this address can be bad,
> > for example in a device driver where the failing instruction is
> > less than 43 bytes from the start of the driver's code. When that
> > happens, try to dump code starting at the failing instruction
> > instead of printing no code at all.
> >
> Shouldn't the kernel be printing some info noting that this fallback
> is in use then? Or will that be completely obvious and I'm just not
> able to see that?
The code byte at EIP is marked with '<>', so it's obvious:
Code: <a1> 00 00 00 00 c7 04 24 05 30 b5 de 89 44 24 04 e8 f5 6f 5c e1 c9 31 c0 c3 00 00 00 00 00 00 00
--
Chuck
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-19 8:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-18 18:22 [patch] i386: show_registers(): try harder to print failing code Chuck Ebbert
2006-07-18 22:12 ` Jesper Juhl
2006-07-19 5:33 ` Keith Owens
2006-07-19 0:25 Chuck Ebbert
2006-07-19 8:59 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®