Skip to contentSkip to conversation

ipipe: x86: Fix user land detection on unhandled non-root faults

PATCH Applied Jan Kiszka 2 participants 2 messages Mar 15, 2012 – Mar 17, 2012 x86

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 ipipe: x86: Fix user land detection on unhandled non-root faults

Not only page faults are processed by __ipipe_handle_exception, so the validity and encoding of error_code varies. Use user_mode_vm instead to detect if the fault was raised over a user context.

---
 arch/x86/kernel/ipipe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/ipipe.c +2 -1
index 5be7005..b2e2a5b 100644
@@ -560,7 +560,8 @@ int __ipipe_handle_exception(struct pt_regs *regs, long error_code, int vector)
 		ipipe_trace_panic_freeze();
 
 		/* Always warn about user land and unfixable faults. */
-		if ((error_code & 4) || !search_exception_tables(instruction_pointer(regs))) {
+		if (user_mode_vm(regs) ||
+		    !search_exception_tables(instruction_pointer(regs))) {
 			printk(KERN_ERR "BUG: Unhandled exception over domain"
 			       " %s at 0x%lx - switching to ROOT\n",
 			       ipd->name, instruction_pointer(regs));
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 14 lines · Jan Kiszka

Not only page faults are processed by __ipipe_handle_exception, so the validity and encoding of error_code varies. Use user_mode_vm instead to detect if the fault was raised over a user context.

---
  arch/x86/kernel/ipipe.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/ipipe.c +0 -0
index 5be7005..b2e2a5b 100644

arch/x86/kernel/ipipe.c int __ipipe_handle_exception(struct pt_regs *regs, long error_code, int vector) · line 567

Quoted 9 lines
arch/x86/kernel/ipipe.c +2 -1
@@ -560,7 +560,8 @@ int __ipipe_handle_exception(struct pt_regs *regs, long error_code, int vector)
  		ipipe_trace_panic_freeze();
 
  		/* Always warn about user land and unfixable faults. */
-		if ((error_code&  4) || !search_exception_tables(instruction_pointer(regs))) {
+		if (user_mode_vm(regs) ||
+		    !search_exception_tables(instruction_pointer(regs))) {
  			printk(KERN_ERR "BUG: Unhandled exception over domain"
  			       " %s at 0x%lx - switching to ROOT\n",
  			       ipd->name, instruction_pointer(regs));

Merged, thanks.

Signature · 1 line
Philippe.