
From: Jeff Dike <jdike@addtoit.com>

From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>

As Jeff pointed out, the check for address wrapping in access_ok_skas
was wrong. Also, change vsyscall_ehdr and vsyscall_end to be
unsigned long and export them, since modules need them for access_ok_skas

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/um/kernel/skas/include/uaccess-skas.h |    4 ++--
 25-akpm/arch/um/os-Linux/elf_aux.c                 |    6 +++---
 25-akpm/arch/um/os-Linux/user_syms.c               |    3 +++
 25-akpm/include/asm-um/archparam-i386.h            |    6 +++---
 4 files changed, 11 insertions(+), 8 deletions(-)

diff -puN arch/um/kernel/skas/include/uaccess-skas.h~uml-small-vsyscall-fixes arch/um/kernel/skas/include/uaccess-skas.h
--- 25/arch/um/kernel/skas/include/uaccess-skas.h~uml-small-vsyscall-fixes	Fri Dec  3 13:50:34 2004
+++ 25-akpm/arch/um/kernel/skas/include/uaccess-skas.h	Fri Dec  3 13:50:34 2004
@@ -14,9 +14,9 @@
 	 (((unsigned long) (addr) < TASK_SIZE) && \
 	  ((unsigned long) (addr) + (size) <= TASK_SIZE)) || \
 	 ((type == VERIFY_READ ) && \
-	  (size <= (FIXADDR_USER_END - FIXADDR_USER_START)) && \
 	  ((unsigned long) (addr) >= FIXADDR_USER_START) && \
-	  ((unsigned long) (addr) + (size) <= FIXADDR_USER_END)))
+	  ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
+	  ((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
 
 static inline int verify_area_skas(int type, const void * addr,
 				   unsigned long size)
diff -puN arch/um/os-Linux/elf_aux.c~uml-small-vsyscall-fixes arch/um/os-Linux/elf_aux.c
--- 25/arch/um/os-Linux/elf_aux.c~uml-small-vsyscall-fixes	Fri Dec  3 13:50:34 2004
+++ 25-akpm/arch/um/os-Linux/elf_aux.c	Fri Dec  3 13:50:34 2004
@@ -20,10 +20,10 @@ typedef Elf64_auxv_t elf_auxv_t;
 char * elf_aux_platform;
 long elf_aux_hwcap;
 
-long vsyscall_ehdr;
-long vsyscall_end;
+unsigned long vsyscall_ehdr;
+unsigned long vsyscall_end;
 
-long __kernel_vsyscall;
+unsigned long __kernel_vsyscall;
 
 
 __init void scan_elf_aux( char **envp)
diff -puN arch/um/os-Linux/user_syms.c~uml-small-vsyscall-fixes arch/um/os-Linux/user_syms.c
--- 25/arch/um/os-Linux/user_syms.c~uml-small-vsyscall-fixes	Fri Dec  3 13:50:34 2004
+++ 25-akpm/arch/um/os-Linux/user_syms.c	Fri Dec  3 13:50:34 2004
@@ -26,6 +26,9 @@ EXPORT_SYMBOL(printf);
 
 EXPORT_SYMBOL(strstr);
 
+EXPORT_SYMBOL(vsyscall_ehdr);
+EXPORT_SYMBOL(vsyscall_end);
+
 /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
  * However, the modules will use the CRC defined *here*, no matter if it is
  * good; so the versions of these symbols will always match
diff -puN include/asm-um/archparam-i386.h~uml-small-vsyscall-fixes include/asm-um/archparam-i386.h
--- 25/include/asm-um/archparam-i386.h~uml-small-vsyscall-fixes	Fri Dec  3 13:50:34 2004
+++ 25-akpm/include/asm-um/archparam-i386.h	Fri Dec  3 13:50:34 2004
@@ -58,9 +58,9 @@ typedef elf_greg_t elf_gregset_t[ELF_NGR
 } while(0);
 
 
-extern long vsyscall_ehdr;
-extern long vsyscall_end;
-extern long __kernel_vsyscall;
+extern unsigned long vsyscall_ehdr;
+extern unsigned long vsyscall_end;
+extern unsigned long __kernel_vsyscall;
 
 #define VSYSCALL_BASE vsyscall_ehdr
 #define VSYSCALL_END vsyscall_end
_
