diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2005-09-22 21:44:16 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-22 22:17:36 -0700 |
commit | 546fe1cbf91d4d62e3849517c31a2327c992e5c5 (patch) | |
tree | c2be2cd1eb19e04c49d22ec77119973fa8f0ea13 /arch/um/kernel/trap_kern.c | |
parent | 69e1e688f5698287b45fbff22a01de91b20804cd (diff) | |
download | talos-obmc-linux-546fe1cbf91d4d62e3849517c31a2327c992e5c5.tar.gz talos-obmc-linux-546fe1cbf91d4d62e3849517c31a2327c992e5c5.zip |
[PATCH] uml: fix hang in TT mode on fault
The current code doesn't handle well general protection faults on the host -
it thinks that cr2 is always the address of a page fault. While actually, on
general protection faults, that address is not accessible, so we'd better
assume we couldn't satisfy the fault. Currently instead we think we've fixed
it, so we go back, retry the instruction and fault again endlessly.
This leads to the kernel hanging when doing copy_from_user(dest, -1, ...) in
TT mode, since reading *(-1) causes a GFP, and we don't support kernel
preemption.
Thanks to Luo Xin for testing UML with LTP and reporting the failures he got.
Cc: Luo Xin <luothing@sina.com>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/trap_kern.c')
-rw-r--r-- | arch/um/kernel/trap_kern.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 87cc6fd76ced..90690b9b1f30 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c @@ -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) |