[PATCH] uml: x86_64 fixes
authorJeff Dike <jdike@addtoit.com>
Sat, 7 May 2005 04:30:55 +0000 (21:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 7 May 2005 05:09:31 +0000 (22:09 -0700)
This fixes some x86_64 bugs -

- maybe_map returns -1 on error instead of 0, which is interpreted as
  physical address 0

- removed an include of ipc.h, which isn't needed

- fixed the calculation of signal frame location

- the signal delivery code is now immune to the stack expansion check

- added a missing include

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/kernel/skas/uaccess.c
arch/um/kernel/syscall_kern.c
arch/um/kernel/trap_kern.c
arch/um/sys-x86_64/signal.c
arch/um/sys-x86_64/syscalls.c

index f7da9d027672d1de660dca3c22695db536ca7524..75195281081e10252e840ea2bf533e3cd193a27d 100644 (file)
@@ -29,9 +29,12 @@ static unsigned long maybe_map(unsigned long virt, int is_write)
        if(IS_ERR(phys) || (is_write && !pte_write(pte))){
                err = handle_page_fault(virt, 0, is_write, 1, &dummy_code);
                if(err)
-                       return(0);
+                       return(-1UL);
                phys = um_virt_to_phys(current, virt, NULL);
        }
+        if(IS_ERR(phys))
+                phys = (void *) -1;
+
        return((unsigned long) phys);
 }
 
@@ -42,7 +45,7 @@ static int do_op(unsigned long addr, int len, int is_write,
        int n;
 
        addr = maybe_map(addr, is_write);
-       if(addr == -1)
+       if(addr == -1UL)
                return(-1);
 
        page = phys_to_page(addr);
index 42731e04f50fda4fdfed91a5142af3ef7019a527..b7a55251e89727d44cf7ba841b309091034edcdb 100644 (file)
@@ -17,7 +17,6 @@
 #include "linux/utime.h"
 #include "asm/mman.h"
 #include "asm/uaccess.h"
-#include "asm/ipc.h"
 #include "kern_util.h"
 #include "user_util.h"
 #include "sysdep/syscalls.h"
index 54e2ec33a43c028f517dd7eda1b53d270c790d49..5fca2c61eb980a631fe70d500b18b9422e17e0cf 100644 (file)
@@ -48,7 +48,7 @@ int handle_page_fault(unsigned long address, unsigned long ip,
                goto good_area;
        else if(!(vma->vm_flags & VM_GROWSDOWN)) 
                goto out;
-       else if(!ARCH_IS_STACKGROW(address))
+       else if(is_user && !ARCH_IS_STACKGROW(address))
                goto out;
        else if(expand_stack(vma, address)) 
                goto out;
index b740177066a06d92de743d204cb2a0aa7d47bfae..73a7926f73705d100809adc35b567cb0594cb712 100644 (file)
@@ -168,7 +168,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
 
        frame = (struct rt_sigframe __user *)
                round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
-       frame -= 128;
+       ((unsigned char *) frame) -= 128;
 
        if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
                goto out;
index 2a575ef52bba70fd104cbd76488c30772b15ee82..dd9914642b8e905e5744d81cf712d9af9a141a84 100644 (file)
@@ -44,6 +44,8 @@ long sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount)
 #ifdef CONFIG_MODE_SKAS
 extern int userspace_pid[];
 
+#include "skas_ptrace.h"
+
 long sys_modify_ldt_skas(int func, void *ptr, unsigned long bytecount)
 {
        struct ptrace_ldt ldt;