diff options
author | Christoph Hellwig <hch@lst.de> | 2010-03-10 18:21:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:32 -0500 |
commit | a4679373cf4ee0e7792dc56205365732b725c2c1 (patch) | |
tree | 6cf8040f608ad46ae7c605284af1ca585fb50eaa | |
parent | 5d0e52830e9ae09b872567f4aca3dfb5b5918079 (diff) |
Add generic sys_old_mmap()
Add a generic implementation of the old mmap() syscall, which expects its
argument in a memory block and switch all architectures over to use it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
31 files changed, 79 insertions, 258 deletions
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index e18500d305ba..e6eeb2d29953 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -443,6 +443,7 @@ | |||
443 | #define __ARCH_WANT_SYS_SIGPROCMASK | 443 | #define __ARCH_WANT_SYS_SIGPROCMASK |
444 | #define __ARCH_WANT_SYS_RT_SIGACTION | 444 | #define __ARCH_WANT_SYS_RT_SIGACTION |
445 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 445 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
446 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
446 | #define __ARCH_WANT_SYS_OLD_SELECT | 447 | #define __ARCH_WANT_SYS_OLD_SELECT |
447 | 448 | ||
448 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | 449 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 7671e9a75449..37ae301cc47c 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -99,7 +99,7 @@ | |||
99 | CALL(sys_swapon) | 99 | CALL(sys_swapon) |
100 | CALL(sys_reboot) | 100 | CALL(sys_reboot) |
101 | CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */ | 101 | CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */ |
102 | /* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */ | 102 | /* 90 */ CALL(OBSOLETE(sys_old_mmap)) /* used by libc4 */ |
103 | CALL(sys_munmap) | 103 | CALL(sys_munmap) |
104 | CALL(sys_truncate) | 104 | CALL(sys_truncate) |
105 | CALL(sys_ftruncate) | 105 | CALL(sys_ftruncate) |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index e59cddedcbba..a2e0e6f2ea7f 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
@@ -28,32 +28,6 @@ | |||
28 | #include <linux/ipc.h> | 28 | #include <linux/ipc.h> |
29 | #include <linux/uaccess.h> | 29 | #include <linux/uaccess.h> |
30 | 30 | ||
31 | struct mmap_arg_struct { | ||
32 | unsigned long addr; | ||
33 | unsigned long len; | ||
34 | unsigned long prot; | ||
35 | unsigned long flags; | ||
36 | unsigned long fd; | ||
37 | unsigned long offset; | ||
38 | }; | ||
39 | |||
40 | asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | ||
41 | { | ||
42 | int error = -EFAULT; | ||
43 | struct mmap_arg_struct a; | ||
44 | |||
45 | if (copy_from_user(&a, arg, sizeof(a))) | ||
46 | goto out; | ||
47 | |||
48 | error = -EINVAL; | ||
49 | if (a.offset & ~PAGE_MASK) | ||
50 | goto out; | ||
51 | |||
52 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | ||
53 | out: | ||
54 | return error; | ||
55 | } | ||
56 | |||
57 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | 31 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) |
58 | /* | 32 | /* |
59 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 33 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S index c52bef39e250..0d6420d087fd 100644 --- a/arch/cris/arch-v10/kernel/entry.S +++ b/arch/cris/arch-v10/kernel/entry.S | |||
@@ -692,7 +692,7 @@ sys_call_table: | |||
692 | .long sys_swapon | 692 | .long sys_swapon |
693 | .long sys_reboot | 693 | .long sys_reboot |
694 | .long sys_old_readdir | 694 | .long sys_old_readdir |
695 | .long old_mmap /* 90 */ | 695 | .long sys_old_mmap /* 90 */ |
696 | .long sys_munmap | 696 | .long sys_munmap |
697 | .long sys_truncate | 697 | .long sys_truncate |
698 | .long sys_ftruncate | 698 | .long sys_ftruncate |
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S index 435b9671bd4b..1f39861eac8c 100644 --- a/arch/cris/arch-v32/kernel/entry.S +++ b/arch/cris/arch-v32/kernel/entry.S | |||
@@ -615,7 +615,7 @@ sys_call_table: | |||
615 | .long sys_swapon | 615 | .long sys_swapon |
616 | .long sys_reboot | 616 | .long sys_reboot |
617 | .long sys_old_readdir | 617 | .long sys_old_readdir |
618 | .long old_mmap /* 90 */ | 618 | .long sys_old_mmap /* 90 */ |
619 | .long sys_munmap | 619 | .long sys_munmap |
620 | .long sys_truncate | 620 | .long sys_truncate |
621 | .long sys_ftruncate | 621 | .long sys_ftruncate |
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h index c17079388bb9..8cffd22623fd 100644 --- a/arch/cris/include/asm/unistd.h +++ b/arch/cris/include/asm/unistd.h | |||
@@ -364,6 +364,7 @@ | |||
364 | #define __ARCH_WANT_SYS_LLSEEK | 364 | #define __ARCH_WANT_SYS_LLSEEK |
365 | #define __ARCH_WANT_SYS_NICE | 365 | #define __ARCH_WANT_SYS_NICE |
366 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 366 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
367 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
367 | #define __ARCH_WANT_SYS_OLDUMOUNT | 368 | #define __ARCH_WANT_SYS_OLDUMOUNT |
368 | #define __ARCH_WANT_SYS_SIGPENDING | 369 | #define __ARCH_WANT_SYS_SIGPENDING |
369 | #define __ARCH_WANT_SYS_SIGPROCMASK | 370 | #define __ARCH_WANT_SYS_SIGPROCMASK |
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c index c2bbb1ac98a9..22f9d6cd947f 100644 --- a/arch/cris/kernel/sys_cris.c +++ b/arch/cris/kernel/sys_cris.c | |||
@@ -26,24 +26,6 @@ | |||
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <asm/segment.h> | 27 | #include <asm/segment.h> |
28 | 28 | ||
29 | asmlinkage unsigned long old_mmap(unsigned long __user *args) | ||
30 | { | ||
31 | unsigned long buffer[6]; | ||
32 | int err = -EFAULT; | ||
33 | |||
34 | if (copy_from_user(&buffer, args, sizeof(buffer))) | ||
35 | goto out; | ||
36 | |||
37 | err = -EINVAL; | ||
38 | if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */ | ||
39 | goto out; | ||
40 | |||
41 | err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3], | ||
42 | buffer[4], buffer[5] >> PAGE_SHIFT); | ||
43 | out: | ||
44 | return err; | ||
45 | } | ||
46 | |||
47 | asmlinkage long | 29 | asmlinkage long |
48 | sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, | 30 | sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, |
49 | unsigned long flags, unsigned long fd, unsigned long pgoff) | 31 | unsigned long flags, unsigned long fd, unsigned long pgoff) |
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h index 3bea0b3eb24f..54dab4726954 100644 --- a/arch/h8300/include/asm/unistd.h +++ b/arch/h8300/include/asm/unistd.h | |||
@@ -348,6 +348,7 @@ | |||
348 | #define __ARCH_WANT_SYS_LLSEEK | 348 | #define __ARCH_WANT_SYS_LLSEEK |
349 | #define __ARCH_WANT_SYS_NICE | 349 | #define __ARCH_WANT_SYS_NICE |
350 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 350 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
351 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
351 | #define __ARCH_WANT_SYS_OLD_SELECT | 352 | #define __ARCH_WANT_SYS_OLD_SELECT |
352 | #define __ARCH_WANT_SYS_OLDUMOUNT | 353 | #define __ARCH_WANT_SYS_OLDUMOUNT |
353 | #define __ARCH_WANT_SYS_SIGPENDING | 354 | #define __ARCH_WANT_SYS_SIGPENDING |
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c index e9a3ecf90c9c..1f13fd6e5309 100644 --- a/arch/h8300/kernel/sys_h8300.c +++ b/arch/h8300/kernel/sys_h8300.c | |||
@@ -27,40 +27,6 @@ | |||
27 | #include <asm/unistd.h> | 27 | #include <asm/unistd.h> |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
31 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | ||
32 | * handle more than 4 system call parameters, so these system calls | ||
33 | * used a memory block for parameter passing.. | ||
34 | */ | ||
35 | |||
36 | struct mmap_arg_struct { | ||
37 | unsigned long addr; | ||
38 | unsigned long len; | ||
39 | unsigned long prot; | ||
40 | unsigned long flags; | ||
41 | unsigned long fd; | ||
42 | unsigned long offset; | ||
43 | }; | ||
44 | |||
45 | asmlinkage int old_mmap(struct mmap_arg_struct *arg) | ||
46 | { | ||
47 | struct mmap_arg_struct a; | ||
48 | int error = -EFAULT; | ||
49 | |||
50 | if (copy_from_user(&a, arg, sizeof(a))) | ||
51 | goto out; | ||
52 | |||
53 | error = -EINVAL; | ||
54 | if (a.offset & ~PAGE_MASK) | ||
55 | goto out; | ||
56 | |||
57 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
58 | a.offset >> PAGE_SHIFT); | ||
59 | out: | ||
60 | return error; | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 30 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
65 | * | 31 | * |
66 | * This is really horribly ugly. | 32 | * This is really horribly ugly. |
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S index fe5ae20e60c5..faefaff7d43d 100644 --- a/arch/h8300/kernel/syscalls.S +++ b/arch/h8300/kernel/syscalls.S | |||
@@ -104,7 +104,7 @@ SYMBOL_NAME_LABEL(sys_call_table) | |||
104 | .long SYMBOL_NAME(sys_swapon) | 104 | .long SYMBOL_NAME(sys_swapon) |
105 | .long SYMBOL_NAME(sys_reboot) | 105 | .long SYMBOL_NAME(sys_reboot) |
106 | .long SYMBOL_NAME(sys_old_readdir) | 106 | .long SYMBOL_NAME(sys_old_readdir) |
107 | .long SYMBOL_NAME(old_mmap) /* 90 */ | 107 | .long SYMBOL_NAME(sys_old_mmap) /* 90 */ |
108 | .long SYMBOL_NAME(sys_munmap) | 108 | .long SYMBOL_NAME(sys_munmap) |
109 | .long SYMBOL_NAME(sys_truncate) | 109 | .long SYMBOL_NAME(sys_truncate) |
110 | .long SYMBOL_NAME(sys_ftruncate) | 110 | .long SYMBOL_NAME(sys_ftruncate) |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 1582c2db1c86..d801154310ea 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -363,6 +363,7 @@ | |||
363 | #define __ARCH_WANT_SYS_LLSEEK | 363 | #define __ARCH_WANT_SYS_LLSEEK |
364 | #define __ARCH_WANT_SYS_NICE | 364 | #define __ARCH_WANT_SYS_NICE |
365 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 365 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
366 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
366 | #define __ARCH_WANT_SYS_OLD_SELECT | 367 | #define __ARCH_WANT_SYS_OLD_SELECT |
367 | #define __ARCH_WANT_SYS_OLDUMOUNT | 368 | #define __ARCH_WANT_SYS_OLDUMOUNT |
368 | #define __ARCH_WANT_SYS_SIGPENDING | 369 | #define __ARCH_WANT_SYS_SIGPENDING |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 09b1f09be3a6..2391bdff0996 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -518,7 +518,7 @@ sys_call_table: | |||
518 | .long sys_swapon | 518 | .long sys_swapon |
519 | .long sys_reboot | 519 | .long sys_reboot |
520 | .long sys_old_readdir | 520 | .long sys_old_readdir |
521 | .long old_mmap /* 90 */ | 521 | .long sys_old_mmap /* 90 */ |
522 | .long sys_munmap | 522 | .long sys_munmap |
523 | .long sys_truncate | 523 | .long sys_truncate |
524 | .long sys_ftruncate | 524 | .long sys_ftruncate |
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 03b58dd86c7a..7b309e7b6cef 100644 --- a/arch/m68k/kernel/sys_m68k.c +++ b/arch/m68k/kernel/sys_m68k.c | |||
@@ -47,40 +47,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | |||
47 | } | 47 | } |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
51 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | ||
52 | * handle more than 4 system call parameters, so these system calls | ||
53 | * used a memory block for parameter passing.. | ||
54 | */ | ||
55 | |||
56 | struct mmap_arg_struct { | ||
57 | unsigned long addr; | ||
58 | unsigned long len; | ||
59 | unsigned long prot; | ||
60 | unsigned long flags; | ||
61 | unsigned long fd; | ||
62 | unsigned long offset; | ||
63 | }; | ||
64 | |||
65 | asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | ||
66 | { | ||
67 | struct mmap_arg_struct a; | ||
68 | int error = -EFAULT; | ||
69 | |||
70 | if (copy_from_user(&a, arg, sizeof(a))) | ||
71 | goto out; | ||
72 | |||
73 | error = -EINVAL; | ||
74 | if (a.offset & ~PAGE_MASK) | ||
75 | goto out; | ||
76 | |||
77 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
78 | a.offset >> PAGE_SHIFT); | ||
79 | out: | ||
80 | return error; | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 50 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
85 | * | 51 | * |
86 | * This is really horribly ugly. | 52 | * This is really horribly ugly. |
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c index e0d3f13e77a8..3e371cc9fd91 100644 --- a/arch/m68knommu/kernel/sys_m68k.c +++ b/arch/m68knommu/kernel/sys_m68k.c | |||
@@ -28,40 +28,6 @@ | |||
28 | #include <asm/unistd.h> | 28 | #include <asm/unistd.h> |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
32 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | ||
33 | * handle more than 4 system call parameters, so these system calls | ||
34 | * used a memory block for parameter passing.. | ||
35 | */ | ||
36 | |||
37 | struct mmap_arg_struct { | ||
38 | unsigned long addr; | ||
39 | unsigned long len; | ||
40 | unsigned long prot; | ||
41 | unsigned long flags; | ||
42 | unsigned long fd; | ||
43 | unsigned long offset; | ||
44 | }; | ||
45 | |||
46 | asmlinkage int old_mmap(struct mmap_arg_struct *arg) | ||
47 | { | ||
48 | struct mmap_arg_struct a; | ||
49 | int error = -EFAULT; | ||
50 | |||
51 | if (copy_from_user(&a, arg, sizeof(a))) | ||
52 | goto out; | ||
53 | |||
54 | error = -EINVAL; | ||
55 | if (a.offset & ~PAGE_MASK) | ||
56 | goto out; | ||
57 | |||
58 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
59 | a.offset >> PAGE_SHIFT); | ||
60 | out: | ||
61 | return error; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 31 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
66 | * | 32 | * |
67 | * This is really horribly ugly. | 33 | * This is really horribly ugly. |
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S index 405738351700..b30b3eb197a5 100644 --- a/arch/m68knommu/kernel/syscalltable.S +++ b/arch/m68knommu/kernel/syscalltable.S | |||
@@ -108,7 +108,7 @@ ENTRY(sys_call_table) | |||
108 | .long sys_ni_syscall /* sys_swapon */ | 108 | .long sys_ni_syscall /* sys_swapon */ |
109 | .long sys_reboot | 109 | .long sys_reboot |
110 | .long sys_old_readdir | 110 | .long sys_old_readdir |
111 | .long old_mmap /* 90 */ | 111 | .long sys_old_mmap /* 90 */ |
112 | .long sys_munmap | 112 | .long sys_munmap |
113 | .long sys_truncate | 113 | .long sys_truncate |
114 | .long sys_ftruncate | 114 | .long sys_ftruncate |
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index 6e9f049fa823..5f0075150a65 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h | |||
@@ -392,6 +392,7 @@ | |||
392 | #define __ARCH_WANT_SYS_LLSEEK | 392 | #define __ARCH_WANT_SYS_LLSEEK |
393 | #define __ARCH_WANT_SYS_NICE | 393 | #define __ARCH_WANT_SYS_NICE |
394 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 394 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
395 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
395 | #define __ARCH_WANT_SYS_OLDUMOUNT | 396 | #define __ARCH_WANT_SYS_OLDUMOUNT |
396 | #define __ARCH_WANT_SYS_SIGPENDING | 397 | #define __ARCH_WANT_SYS_SIGPENDING |
397 | #define __ARCH_WANT_SYS_SIGPROCMASK | 398 | #define __ARCH_WANT_SYS_SIGPROCMASK |
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h index 9905a0cacf93..5de54d2af0b2 100644 --- a/arch/s390/kernel/entry.h +++ b/arch/s390/kernel/entry.h | |||
@@ -25,12 +25,11 @@ void __init startup_init(void); | |||
25 | void die(const char * str, struct pt_regs * regs, long err); | 25 | void die(const char * str, struct pt_regs * regs, long err); |
26 | 26 | ||
27 | struct new_utsname; | 27 | struct new_utsname; |
28 | struct mmap_arg_struct; | 28 | struct s390_mmap_arg_struct; |
29 | struct fadvise64_64_args; | 29 | struct fadvise64_64_args; |
30 | struct old_sigaction; | 30 | struct old_sigaction; |
31 | 31 | ||
32 | long sys_mmap2(struct mmap_arg_struct __user *arg); | 32 | long sys_mmap2(struct s390_mmap_arg_struct __user *arg); |
33 | long sys_s390_old_mmap(struct mmap_arg_struct __user *arg); | ||
34 | long sys_ipc(uint call, int first, unsigned long second, | 33 | long sys_ipc(uint call, int first, unsigned long second, |
35 | unsigned long third, void __user *ptr); | 34 | unsigned long third, void __user *ptr); |
36 | long sys_s390_newuname(struct new_utsname __user *name); | 35 | long sys_s390_newuname(struct new_utsname __user *name); |
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index 86a74c9c9e63..b2563509b5a9 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c | |||
@@ -33,13 +33,12 @@ | |||
33 | #include "entry.h" | 33 | #include "entry.h" |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Perform the select(nd, in, out, ex, tv) and mmap() system | 36 | * Perform the mmap() system call. Linux for S/390 isn't able to handle more |
37 | * calls. Linux for S/390 isn't able to handle more than 5 | 37 | * than 5 system call parameters, so this system call uses a memory block |
38 | * system call parameters, so these system calls used a memory | 38 | * for parameter passing. |
39 | * block for parameter passing.. | ||
40 | */ | 39 | */ |
41 | 40 | ||
42 | struct mmap_arg_struct { | 41 | struct s390_mmap_arg_struct { |
43 | unsigned long addr; | 42 | unsigned long addr; |
44 | unsigned long len; | 43 | unsigned long len; |
45 | unsigned long prot; | 44 | unsigned long prot; |
@@ -48,9 +47,9 @@ struct mmap_arg_struct { | |||
48 | unsigned long offset; | 47 | unsigned long offset; |
49 | }; | 48 | }; |
50 | 49 | ||
51 | SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg) | 50 | SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) |
52 | { | 51 | { |
53 | struct mmap_arg_struct a; | 52 | struct s390_mmap_arg_struct a; |
54 | int error = -EFAULT; | 53 | int error = -EFAULT; |
55 | 54 | ||
56 | if (copy_from_user(&a, arg, sizeof(a))) | 55 | if (copy_from_user(&a, arg, sizeof(a))) |
@@ -60,23 +59,6 @@ out: | |||
60 | return error; | 59 | return error; |
61 | } | 60 | } |
62 | 61 | ||
63 | SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg) | ||
64 | { | ||
65 | struct mmap_arg_struct a; | ||
66 | long error = -EFAULT; | ||
67 | |||
68 | if (copy_from_user(&a, arg, sizeof(a))) | ||
69 | goto out; | ||
70 | |||
71 | error = -EINVAL; | ||
72 | if (a.offset & ~PAGE_MASK) | ||
73 | goto out; | ||
74 | |||
75 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | ||
76 | out: | ||
77 | return error; | ||
78 | } | ||
79 | |||
80 | /* | 62 | /* |
81 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 63 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
82 | * | 64 | * |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 30eca070d426..2a24766567af 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper) | |||
98 | SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) | 98 | SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) |
99 | SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) | 99 | SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) |
100 | SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ | 100 | SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ |
101 | SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */ | 101 | SYSCALL(sys_old_mmap,sys_old_mmap,old32_mmap_wrapper) /* 90 */ |
102 | SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) | 102 | SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) |
103 | SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) | 103 | SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) |
104 | SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) | 104 | SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) |
diff --git a/arch/um/sys-i386/shared/sysdep/syscalls.h b/arch/um/sys-i386/shared/sysdep/syscalls.h index e7787679e317..05cb796aecb5 100644 --- a/arch/um/sys-i386/shared/sysdep/syscalls.h +++ b/arch/um/sys-i386/shared/sysdep/syscalls.h | |||
@@ -13,8 +13,6 @@ typedef long syscall_handler_t(struct pt_regs); | |||
13 | */ | 13 | */ |
14 | extern syscall_handler_t sys_rt_sigaction; | 14 | extern syscall_handler_t sys_rt_sigaction; |
15 | 15 | ||
16 | extern syscall_handler_t old_mmap_i386; | ||
17 | |||
18 | extern syscall_handler_t *sys_call_table[]; | 16 | extern syscall_handler_t *sys_call_table[]; |
19 | 17 | ||
20 | #define EXECUTE_SYSCALL(syscall, regs) \ | 18 | #define EXECUTE_SYSCALL(syscall, regs) \ |
diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/um/sys-i386/sys_call_table.S index c6260dd6ebb9..de274071455d 100644 --- a/arch/um/sys-i386/sys_call_table.S +++ b/arch/um/sys-i386/sys_call_table.S | |||
@@ -7,7 +7,7 @@ | |||
7 | #define sys_vm86old sys_ni_syscall | 7 | #define sys_vm86old sys_ni_syscall |
8 | #define sys_vm86 sys_ni_syscall | 8 | #define sys_vm86 sys_ni_syscall |
9 | 9 | ||
10 | #define old_mmap old_mmap_i386 | 10 | #define old_mmap sys_old_mmap |
11 | 11 | ||
12 | #define ptregs_fork sys_fork | 12 | #define ptregs_fork sys_fork |
13 | #define ptregs_execve sys_execve | 13 | #define ptregs_execve sys_execve |
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c index 0e49d2a20c17..d0aa8f125ee6 100644 --- a/arch/um/sys-i386/syscalls.c +++ b/arch/um/sys-i386/syscalls.c | |||
@@ -12,39 +12,6 @@ | |||
12 | #include "asm/unistd.h" | 12 | #include "asm/unistd.h" |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
16 | * calls. Linux/i386 didn't use to be able to handle more than | ||
17 | * 4 system call parameters, so these system calls used a memory | ||
18 | * block for parameter passing.. | ||
19 | */ | ||
20 | |||
21 | struct mmap_arg_struct { | ||
22 | unsigned long addr; | ||
23 | unsigned long len; | ||
24 | unsigned long prot; | ||
25 | unsigned long flags; | ||
26 | unsigned long fd; | ||
27 | unsigned long offset; | ||
28 | }; | ||
29 | |||
30 | extern int old_mmap(unsigned long addr, unsigned long len, | ||
31 | unsigned long prot, unsigned long flags, | ||
32 | unsigned long fd, unsigned long offset); | ||
33 | |||
34 | long old_mmap_i386(struct mmap_arg_struct __user *arg) | ||
35 | { | ||
36 | struct mmap_arg_struct a; | ||
37 | int err = -EFAULT; | ||
38 | |||
39 | if (copy_from_user(&a, arg, sizeof(a))) | ||
40 | goto out; | ||
41 | |||
42 | err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); | ||
43 | out: | ||
44 | return err; | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * The prototype on i386 is: | 15 | * The prototype on i386 is: |
49 | * | 16 | * |
50 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) | 17 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index cb80816e7a16..56c99f46e289 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
@@ -143,7 +143,7 @@ asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename, | |||
143 | * block for parameter passing.. | 143 | * block for parameter passing.. |
144 | */ | 144 | */ |
145 | 145 | ||
146 | struct mmap_arg_struct { | 146 | struct mmap_arg_struct32 { |
147 | unsigned int addr; | 147 | unsigned int addr; |
148 | unsigned int len; | 148 | unsigned int len; |
149 | unsigned int prot; | 149 | unsigned int prot; |
@@ -152,9 +152,9 @@ struct mmap_arg_struct { | |||
152 | unsigned int offset; | 152 | unsigned int offset; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | 155 | asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg) |
156 | { | 156 | { |
157 | struct mmap_arg_struct a; | 157 | struct mmap_arg_struct32 a; |
158 | 158 | ||
159 | if (copy_from_user(&a, arg, sizeof(a))) | 159 | if (copy_from_user(&a, arg, sizeof(a))) |
160 | return -EFAULT; | 160 | return -EFAULT; |
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h index b26fc750e416..7d348d803669 100644 --- a/arch/x86/include/asm/sys_ia32.h +++ b/arch/x86/include/asm/sys_ia32.h | |||
@@ -26,8 +26,8 @@ asmlinkage long sys32_lstat64(char __user *, struct stat64 __user *); | |||
26 | asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); | 26 | asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); |
27 | asmlinkage long sys32_fstatat(unsigned int, char __user *, | 27 | asmlinkage long sys32_fstatat(unsigned int, char __user *, |
28 | struct stat64 __user *, int); | 28 | struct stat64 __user *, int); |
29 | struct mmap_arg_struct; | 29 | struct mmap_arg_struct32; |
30 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *); | 30 | asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); |
31 | asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); | 31 | asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); |
32 | 32 | ||
33 | struct sigaction32; | 33 | struct sigaction32; |
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 8406d06c118d..86ab6a0623fd 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -51,11 +51,9 @@ asmlinkage int sys_sigaction(int, const struct old_sigaction __user *, | |||
51 | unsigned long sys_sigreturn(struct pt_regs *); | 51 | unsigned long sys_sigreturn(struct pt_regs *); |
52 | 52 | ||
53 | /* kernel/sys_i386_32.c */ | 53 | /* kernel/sys_i386_32.c */ |
54 | struct mmap_arg_struct; | ||
55 | struct oldold_utsname; | 54 | struct oldold_utsname; |
56 | struct old_utsname; | 55 | struct old_utsname; |
57 | 56 | ||
58 | asmlinkage int old_mmap(struct mmap_arg_struct __user *); | ||
59 | asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); | 57 | asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); |
60 | asmlinkage int sys_uname(struct old_utsname __user *); | 58 | asmlinkage int sys_uname(struct old_utsname __user *); |
61 | asmlinkage int sys_olduname(struct oldold_utsname __user *); | 59 | asmlinkage int sys_olduname(struct oldold_utsname __user *); |
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h index 4eb2667b54ae..daa65d9aae95 100644 --- a/arch/x86/include/asm/unistd_32.h +++ b/arch/x86/include/asm/unistd_32.h | |||
@@ -366,6 +366,7 @@ | |||
366 | #define __ARCH_WANT_SYS_LLSEEK | 366 | #define __ARCH_WANT_SYS_LLSEEK |
367 | #define __ARCH_WANT_SYS_NICE | 367 | #define __ARCH_WANT_SYS_NICE |
368 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 368 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
369 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
369 | #define __ARCH_WANT_SYS_OLD_SELECT | 370 | #define __ARCH_WANT_SYS_OLD_SELECT |
370 | #define __ARCH_WANT_SYS_OLDUMOUNT | 371 | #define __ARCH_WANT_SYS_OLDUMOUNT |
371 | #define __ARCH_WANT_SYS_SIGPENDING | 372 | #define __ARCH_WANT_SYS_SIGPENDING |
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c index 345dbd19a2b3..7955e90c8341 100644 --- a/arch/x86/kernel/sys_i386_32.c +++ b/arch/x86/kernel/sys_i386_32.c | |||
@@ -25,40 +25,6 @@ | |||
25 | #include <asm/syscalls.h> | 25 | #include <asm/syscalls.h> |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
29 | * calls. Linux/i386 didn't use to be able to handle more than | ||
30 | * 4 system call parameters, so these system calls used a memory | ||
31 | * block for parameter passing.. | ||
32 | */ | ||
33 | |||
34 | struct mmap_arg_struct { | ||
35 | unsigned long addr; | ||
36 | unsigned long len; | ||
37 | unsigned long prot; | ||
38 | unsigned long flags; | ||
39 | unsigned long fd; | ||
40 | unsigned long offset; | ||
41 | }; | ||
42 | |||
43 | asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | ||
44 | { | ||
45 | struct mmap_arg_struct a; | ||
46 | int err = -EFAULT; | ||
47 | |||
48 | if (copy_from_user(&a, arg, sizeof(a))) | ||
49 | goto out; | ||
50 | |||
51 | err = -EINVAL; | ||
52 | if (a.offset & ~PAGE_MASK) | ||
53 | goto out; | ||
54 | |||
55 | err = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, | ||
56 | a.fd, a.offset >> PAGE_SHIFT); | ||
57 | out: | ||
58 | return err; | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 28 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
63 | * | 29 | * |
64 | * This is really horribly ugly. | 30 | * This is really horribly ugly. |
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S index 4d10abacecdb..8b3729341216 100644 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S | |||
@@ -89,7 +89,7 @@ ENTRY(sys_call_table) | |||
89 | .long sys_swapon | 89 | .long sys_swapon |
90 | .long sys_reboot | 90 | .long sys_reboot |
91 | .long sys_old_readdir | 91 | .long sys_old_readdir |
92 | .long old_mmap /* 90 */ | 92 | .long sys_old_mmap /* 90 */ |
93 | .long sys_munmap | 93 | .long sys_munmap |
94 | .long sys_truncate | 94 | .long sys_truncate |
95 | .long sys_ftruncate | 95 | .long sys_ftruncate |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 85a9f21fe11a..b60907e3b0d5 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -23,6 +23,7 @@ struct kexec_segment; | |||
23 | struct linux_dirent; | 23 | struct linux_dirent; |
24 | struct linux_dirent64; | 24 | struct linux_dirent64; |
25 | struct list_head; | 25 | struct list_head; |
26 | struct mmap_arg_struct; | ||
26 | struct msgbuf; | 27 | struct msgbuf; |
27 | struct msghdr; | 28 | struct msghdr; |
28 | struct mmsghdr; | 29 | struct mmsghdr; |
@@ -838,4 +839,6 @@ asmlinkage long sys_perf_event_open( | |||
838 | asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, | 839 | asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, |
839 | unsigned long prot, unsigned long flags, | 840 | unsigned long prot, unsigned long flags, |
840 | unsigned long fd, unsigned long pgoff); | 841 | unsigned long fd, unsigned long pgoff); |
842 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); | ||
843 | |||
841 | #endif | 844 | #endif |
@@ -1088,6 +1088,30 @@ out: | |||
1088 | return retval; | 1088 | return retval; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | #ifdef __ARCH_WANT_SYS_OLD_MMAP | ||
1092 | struct mmap_arg_struct { | ||
1093 | unsigned long addr; | ||
1094 | unsigned long len; | ||
1095 | unsigned long prot; | ||
1096 | unsigned long flags; | ||
1097 | unsigned long fd; | ||
1098 | unsigned long offset; | ||
1099 | }; | ||
1100 | |||
1101 | SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) | ||
1102 | { | ||
1103 | struct mmap_arg_struct a; | ||
1104 | |||
1105 | if (copy_from_user(&a, arg, sizeof(a))) | ||
1106 | return -EFAULT; | ||
1107 | if (a.offset & ~PAGE_MASK) | ||
1108 | return -EINVAL; | ||
1109 | |||
1110 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
1111 | a.offset >> PAGE_SHIFT); | ||
1112 | } | ||
1113 | #endif /* __ARCH_WANT_SYS_OLD_MMAP */ | ||
1114 | |||
1091 | /* | 1115 | /* |
1092 | * Some shared mappigns will want the pages marked read-only | 1116 | * Some shared mappigns will want the pages marked read-only |
1093 | * to track write events. If so, we'll downgrade vm_page_prot | 1117 | * to track write events. If so, we'll downgrade vm_page_prot |
diff --git a/mm/nommu.c b/mm/nommu.c index b9b5cceb1b68..605ace8982a8 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1428,6 +1428,30 @@ out: | |||
1428 | return retval; | 1428 | return retval; |
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | #ifdef __ARCH_WANT_SYS_OLD_MMAP | ||
1432 | struct mmap_arg_struct { | ||
1433 | unsigned long addr; | ||
1434 | unsigned long len; | ||
1435 | unsigned long prot; | ||
1436 | unsigned long flags; | ||
1437 | unsigned long fd; | ||
1438 | unsigned long offset; | ||
1439 | }; | ||
1440 | |||
1441 | SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) | ||
1442 | { | ||
1443 | struct mmap_arg_struct a; | ||
1444 | |||
1445 | if (copy_from_user(&a, arg, sizeof(a))) | ||
1446 | return -EFAULT; | ||
1447 | if (a.offset & ~PAGE_MASK) | ||
1448 | return -EINVAL; | ||
1449 | |||
1450 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
1451 | a.offset >> PAGE_SHIFT); | ||
1452 | } | ||
1453 | #endif /* __ARCH_WANT_SYS_OLD_MMAP */ | ||
1454 | |||
1431 | /* | 1455 | /* |
1432 | * split a vma into two pieces at address 'addr', a new vma is allocated either | 1456 | * split a vma into two pieces at address 'addr', a new vma is allocated either |
1433 | * for the first part or the tail. | 1457 | * for the first part or the tail. |