Skip to contentSkip to conversation

Print error code in page faults

PATCH In review Glauber de Oliveira Costa 3 participants 4 messages Feb 24, 2007 – Feb 25, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Print error code in page faults

When a page faults comes from a kernel space, the printed summary leaves us clueless about what kind of access was being tried (which is encoded in the error_code variable).

Having it promply available may ease debugging in a bunch of situations.

arch/x86_64/mm/fault.c +1 -1
index 6ada723..e65522e 100644
@@ -539,7 +539,7 @@ no_context:
 		printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
 	else
 		printk(KERN_ALERT "Unable to handle kernel paging request");
-	printk(" at %016lx RIP: \n" KERN_ALERT,address);
+	printk(" at %016lx (error=0x%02lx) RIP: \n" KERN_ALERT, error_code, address);
 	printk_address(regs->rip);
 	dump_pagetable(address);
 	tsk->thread.cr2 = address;
#1 lore raw
Quoted 18 lines · Glauber de Oliveira Costa

When a page faults comes from a kernel space, the printed summary leaves us clueless about what kind of access was being tried (which is encoded in the error_code variable).

Having it promply available may ease debugging in a bunch of situations.

------------------------------------------------------------------------

arch/x86_64/mm/fault.c +0 -0
index 6ada723..e65522e 100644

arch/x86_64/mm/fault.c no_context: · line 545

Quoted 8 lines
arch/x86_64/mm/fault.c +1 -1
@@ -539,7 +539,7 @@ no_context:
 		printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
 	else
 		printk(KERN_ALERT "Unable to handle kernel paging request");
-	printk(" at %016lx RIP: \n" KERN_ALERT,address);
+	printk(" at %016lx (error=0x%02lx) RIP: \n" KERN_ALERT, error_code, address);
 	printk_address(regs->rip);
 	dump_pagetable(address);
 	tsk->thread.cr2 = address;

Umm, it's already there, right after the word "Oops".

Oops: 0002 [1] SMP
      ^^^^
#2 lore raw
Quoted 6 lines · Chuck Ebbert

Umm, it's already there, right after the word "Oops".

Oops: 0002 [1] SMP
      ^^^^

Oops! ;-)

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
#3 lore raw
In reply to Glauber de Oliveira Costa
Quoted 6 lines · Glauber de Oliveira Costa

When a page faults comes from a kernel space, the printed summary leaves us clueless about what kind of access was being tried (which is encoded in the error_code variable).

Having it promply available may ease debugging in a bunch of situations.

It's in the __die output. I don't think outputting it twice is needed

-Andi