virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Lguest32 print hex on bad reads and writes
@ 2007-04-04 19:14 Steven Rostedt
  2007-04-05  3:01 ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2007-04-04 19:14 UTC (permalink / raw)
  To: virtualization, Glauber de Oliveira Costa, Rusty Russell
  Cc: Linux Kernel Mailing List

Currently the lguest32 error messages from bad reads and writes prints a
decimal integer for addresses. This is pretty annoying. So this patch
changes those to be hex outputs.

This is applied on top of my debug patch.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Index: linux-2.6.21-rc5-mm2/drivers/lguest/core.c
===================================================================
--- linux-2.6.21-rc5-mm2.orig/drivers/lguest/core.c
+++ linux-2.6.21-rc5-mm2/drivers/lguest/core.c
@@ -220,7 +220,7 @@ u8 lgread_u8(struct lguest *lg, u32 addr
 	/* Don't let them access lguest binary */
 	if (!lguest_address_ok(lg, addr)
 	    || get_user(val, (u32 __user *)addr) != 0)
-		kill_guest(lg, "bad read address %u", addr);
+		kill_guest(lg, "bad read address %x", addr);
 	return val;
 }
 
@@ -231,7 +231,7 @@ u16 lgread_u16(struct lguest *lg, u32 ad
 	/* Don't let them access lguest binary */
 	if (!lguest_address_ok(lg, addr)
 	    || get_user(val, (u32 __user *)addr) != 0)
-		kill_guest(lg, "bad read address %u", addr);
+		kill_guest(lg, "bad read address %x", addr);
 	return val;
 }
 
@@ -242,7 +242,7 @@ u32 lgread_u32(struct lguest *lg, u32 ad
 	/* Don't let them access lguest binary */
 	if (!lguest_address_ok(lg, addr)
 	    || get_user(val, (u32 __user *)addr) != 0)
-		kill_guest(lg, "bad read address %u", addr);
+		kill_guest(lg, "bad read address %x", addr);
 	return val;
 }
 
@@ -250,7 +250,7 @@ void lgwrite_u32(struct lguest *lg, u32 
 {
 	if (!lguest_address_ok(lg, addr)
 	    || put_user(val, (u32 __user *)addr) != 0)
-		kill_guest(lg, "bad write address %u", addr);
+		kill_guest(lg, "bad write address %x", addr);
 }
 
 void lgread(struct lguest *lg, void *b, u32 addr, unsigned bytes)
@@ -259,7 +259,7 @@ void lgread(struct lguest *lg, void *b, 
 	    || copy_from_user(b, (void __user *)addr, bytes) != 0) {
 		/* copy_from_user should do this, but as we rely on it... */
 		memset(b, 0, bytes);
-		kill_guest(lg, "bad read address %u len %u", addr, bytes);
+		kill_guest(lg, "bad read address %x len %u", addr, bytes);
 	}
 }
 
@@ -268,7 +268,7 @@ void lgwrite(struct lguest *lg, u32 addr
 	if (addr + bytes < addr
 	    || !lguest_address_ok(lg, addr+bytes)
 	    || copy_to_user((void __user *)addr, b, bytes) != 0)
-		kill_guest(lg, "bad write address %u len %u", addr, bytes);
+		kill_guest(lg, "bad write address %x len %u", addr, bytes);
 }
 
 static void set_ts(unsigned int guest_ts)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-04 19:14 [PATCH] Lguest32 print hex on bad reads and writes Steven Rostedt
@ 2007-04-05  3:01 ` Rusty Russell
  2007-04-05  3:06   ` Kyle Moffett
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2007-04-05  3:01 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: virtualization, Glauber de Oliveira Costa,
	Linux Kernel Mailing List

On Wed, 2007-04-04 at 15:14 -0400, Steven Rostedt wrote:
> Currently the lguest32 error messages from bad reads and writes prints a
> decimal integer for addresses. This is pretty annoying. So this patch
> changes those to be hex outputs.

(Erk, I wonder what I was thinking when I wrote that?)

Can I ask for %#x (or 0x%x)?  I'm easily confused.

Thanks!
Rusty.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-05  3:01 ` Rusty Russell
@ 2007-04-05  3:06   ` Kyle Moffett
  2007-04-05  3:14     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Moffett @ 2007-04-05  3:06 UTC (permalink / raw)
  To: Rusty Russell; +Cc: virtualization, Linux Kernel Mailing List

On Apr 04, 2007, at 23:01:30, Rusty Russell wrote:
> On Wed, 2007-04-04 at 15:14 -0400, Steven Rostedt wrote:
>> Currently the lguest32 error messages from bad reads and writes  
>> prints a decimal integer for addresses. This is pretty annoying.  
>> So this patch changes those to be hex outputs.
>
> (Erk, I wonder what I was thinking when I wrote that?) Can I ask  
> for %#x (or 0x%x)?  I'm easily confused.

How about "%p" for pointers?

Cheers,
Kyle Moffett

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-05  3:06   ` Kyle Moffett
@ 2007-04-05  3:14     ` Steven Rostedt
  2007-04-05  3:34       ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2007-04-05  3:14 UTC (permalink / raw)
  To: Kyle Moffett
  Cc: Rusty Russell, virtualization, Glauber de Oliveira Costa,
	Linux Kernel Mailing List

On Wed, 2007-04-04 at 23:06 -0400, Kyle Moffett wrote:

> > (Erk, I wonder what I was thinking when I wrote that?) Can I ask  
> > for %#x (or 0x%x)?  I'm easily confused.
> 
> How about "%p" for pointers?

But that would require casting the numbers to pointers.

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-05  3:14     ` Steven Rostedt
@ 2007-04-05  3:34       ` Rusty Russell
  2007-04-05  5:58         ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2007-04-05  3:34 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: virtualization, Linux Kernel Mailing List, Kyle Moffett

On Wed, 2007-04-04 at 23:14 -0400, Steven Rostedt wrote:
> On Wed, 2007-04-04 at 23:06 -0400, Kyle Moffett wrote:
> 
> > > (Erk, I wonder what I was thinking when I wrote that?) Can I ask  
> > > for %#x (or 0x%x)?  I'm easily confused.
> > 
> > How about "%p" for pointers?
> 
> But that would require casting the numbers to pointers.

And the kernel's printk doesn't put 0x on pointers anyway, last I
checked 8(

Rusty.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-05  3:34       ` Rusty Russell
@ 2007-04-05  5:58         ` H. Peter Anvin
  2007-04-05  6:17           ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2007-04-05  5:58 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Steven Rostedt, virtualization, Linux Kernel Mailing List,
	Kyle Moffett

Rusty Russell wrote:
> On Wed, 2007-04-04 at 23:14 -0400, Steven Rostedt wrote:
>> On Wed, 2007-04-04 at 23:06 -0400, Kyle Moffett wrote:
>>
>>>> (Erk, I wonder what I was thinking when I wrote that?) Can I ask  
>>>> for %#x (or 0x%x)?  I'm easily confused.
>>> How about "%p" for pointers?
>> But that would require casting the numbers to pointers.
> 
> And the kernel's printk doesn't put 0x on pointers anyway, last I
> checked 8(
> 

That's really the bug.  Let's fix it.

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Lguest32 print hex on bad reads and writes
  2007-04-05  5:58         ` H. Peter Anvin
@ 2007-04-05  6:17           ` H. Peter Anvin
  0 siblings, 0 replies; 7+ messages in thread
From: H. Peter Anvin @ 2007-04-05  6:17 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Rusty Russell, Steven Rostedt, virtualization,
	Linux Kernel Mailing List, Kyle Moffett

H. Peter Anvin wrote:
> Rusty Russell wrote:
>> On Wed, 2007-04-04 at 23:14 -0400, Steven Rostedt wrote:
>>> On Wed, 2007-04-04 at 23:06 -0400, Kyle Moffett wrote:
>>>
>>>>> (Erk, I wonder what I was thinking when I wrote that?) Can I ask  
>>>>> for %#x (or 0x%x)?  I'm easily confused.
>>>> How about "%p" for pointers?
>>> But that would require casting the numbers to pointers.
>>
>> And the kernel's printk doesn't put 0x on pointers anyway, last I
>> checked 8(
>>
> 
> That's really the bug.  Let's fix it.
> 
>     -hpa

Okay, git tree at:

http://git.kernel.org/?p=linux/kernel/git/hpa/linux-2.6-printk.git;a=summary
git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-printk.git

... will do actual testing and post it to LKML tomorrow.

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-04-05  6:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-04 19:14 [PATCH] Lguest32 print hex on bad reads and writes Steven Rostedt
2007-04-05  3:01 ` Rusty Russell
2007-04-05  3:06   ` Kyle Moffett
2007-04-05  3:14     ` Steven Rostedt
2007-04-05  3:34       ` Rusty Russell
2007-04-05  5:58         ` H. Peter Anvin
2007-04-05  6:17           ` H. Peter Anvin

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).