Skip to contentSkip to conversation

i386: fix recursive fault in page-fault handler

PATCH In review Chuck Ebbert 3 participants 3 messages Jul 17, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: fix recursive fault in page-fault handler

Krzysztof Halasa reported recursive faults in do_page_fault() causing a stream of partial oops messages on the console. Fix by adding a fixup for that code.

---

x86_64 looks like it has the same problem.

arch/i386/mm/fault.c +14 -3
@@ -585,9 +585,20 @@ no_context:
 		printk(KERN_ALERT "*pte = %08lx\n", page);
 	}
 #endif
-	tsk->thread.cr2 = address;
-	tsk->thread.trap_no = 14;
-	tsk->thread.error_code = error_code;
+	asm (	"# set task data without causing another oops\n"
+		"1:\t"
+		"movl %3,%0\n\t"
+		"movl $14,%1\n\t"
+		"movl %4,%2\n"
+		"2:\n"
+		".section __ex_table,\"a\"\n\t"
+		".align 4\n\t"
+		".long 1b,2b\n"
+		".previous"
+		: "=m" (tsk->thread.cr2), "=m" (tsk->thread.trap_no),
+		  "=m" (tsk->thread.error_code)
+		: "r" (address), "r" (error_code)
+	);
 	die("Oops", regs, error_code);
 	bust_spinlocks(0);
 	do_exit(SIGKILL);
Signature · 2 lines
And did you exchange a walk-on part in the war for a lead role in a cage?
        --Roger Waters
#1 lore raw
Quoted 4 lines · Chuck Ebbert

Krzysztof Halasa reported recursive faults in do_page_fault() causing a stream of partial oops messages on the console. Fix by adding a fixup for that code.

This patch is really too ugly to live. Does it even work? If 'tsk' is broken, I'd expect the die() to oops anyway - it does

	if (notify_die(DIE_OOPS, str, regs, err,
                       current->thread.trap_no, SIGSEG...

anyway (where that "current->thread.trap_no" gets dereferenced).

Linus

#2 lore raw
In reply to Chuck Ebbert
Quoted 3 lines · Chuck Ebbert

Krzysztof Halasa reported recursive faults in do_page_fault() causing a stream of partial oops messages on the console. Fix by adding a fixup for that code.

Please just use __put_user, no need to do it in full inline assembly

-Andi