[PATCH] uml: fix hang in TT mode on fault
[pandora-kernel.git] / arch / um / kernel / trap_kern.c
index 87cc6fd..90690b9 100644 (file)
@@ -18,6 +18,7 @@
 #include "asm/a.out.h"
 #include "asm/current.h"
 #include "asm/irq.h"
+#include "sysdep/sigcontext.h"
 #include "user_util.h"
 #include "kern_util.h"
 #include "kern.h"
@@ -125,7 +126,15 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
         }
        else if(current->mm == NULL)
                panic("Segfault with no mm");
-       err = handle_page_fault(address, ip, is_write, is_user, &si.si_code);
+
+       if (SEGV_IS_FIXABLE(&fi))
+               err = handle_page_fault(address, ip, is_write, is_user, &si.si_code);
+       else {
+               err = -EFAULT;
+               /* A thread accessed NULL, we get a fault, but CR2 is invalid.
+                * This code is used in __do_copy_from_user() of TT mode. */
+               address = 0;
+       }
 
        catcher = current->thread.fault_catcher;
        if(!err)