diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 2 | ||||
-rw-r--r-- | arch/x86/ia32/sys_ia32.c | 43 | ||||
-rw-r--r-- | arch/x86/include/asm/sys_ia32.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/syscalls.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/sys_i386_32.c | 27 | ||||
-rw-r--r-- | arch/x86/kernel/sys_x86_64.c | 17 | ||||
-rw-r--r-- | arch/x86/kernel/syscall_table_32.S | 2 |
7 files changed, 5 insertions, 91 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 4eefdca9832b..53147ad85b96 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -696,7 +696,7 @@ ia32_sys_call_table: | |||
696 | .quad quiet_ni_syscall /* streams2 */ | 696 | .quad quiet_ni_syscall /* streams2 */ |
697 | .quad stub32_vfork /* 190 */ | 697 | .quad stub32_vfork /* 190 */ |
698 | .quad compat_sys_getrlimit | 698 | .quad compat_sys_getrlimit |
699 | .quad sys32_mmap2 | 699 | .quad sys_mmap_pgoff |
700 | .quad sys32_truncate64 | 700 | .quad sys32_truncate64 |
701 | .quad sys32_ftruncate64 | 701 | .quad sys32_ftruncate64 |
702 | .quad sys32_stat64 /* 195 */ | 702 | .quad sys32_stat64 /* 195 */ |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index df82c0e48ded..422572c77923 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
@@ -155,9 +155,6 @@ struct mmap_arg_struct { | |||
155 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | 155 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) |
156 | { | 156 | { |
157 | struct mmap_arg_struct a; | 157 | struct mmap_arg_struct a; |
158 | struct file *file = NULL; | ||
159 | unsigned long retval; | ||
160 | struct mm_struct *mm ; | ||
161 | 158 | ||
162 | if (copy_from_user(&a, arg, sizeof(a))) | 159 | if (copy_from_user(&a, arg, sizeof(a))) |
163 | return -EFAULT; | 160 | return -EFAULT; |
@@ -165,22 +162,8 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | |||
165 | if (a.offset & ~PAGE_MASK) | 162 | if (a.offset & ~PAGE_MASK) |
166 | return -EINVAL; | 163 | return -EINVAL; |
167 | 164 | ||
168 | if (!(a.flags & MAP_ANONYMOUS)) { | 165 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
169 | file = fget(a.fd); | ||
170 | if (!file) | ||
171 | return -EBADF; | ||
172 | } | ||
173 | |||
174 | mm = current->mm; | ||
175 | down_write(&mm->mmap_sem); | ||
176 | retval = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, | ||
177 | a.offset>>PAGE_SHIFT); | 166 | a.offset>>PAGE_SHIFT); |
178 | if (file) | ||
179 | fput(file); | ||
180 | |||
181 | up_write(&mm->mmap_sem); | ||
182 | |||
183 | return retval; | ||
184 | } | 167 | } |
185 | 168 | ||
186 | asmlinkage long sys32_mprotect(unsigned long start, size_t len, | 169 | asmlinkage long sys32_mprotect(unsigned long start, size_t len, |
@@ -483,30 +466,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, | |||
483 | return ret; | 466 | return ret; |
484 | } | 467 | } |
485 | 468 | ||
486 | asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, | ||
487 | unsigned long prot, unsigned long flags, | ||
488 | unsigned long fd, unsigned long pgoff) | ||
489 | { | ||
490 | struct mm_struct *mm = current->mm; | ||
491 | unsigned long error; | ||
492 | struct file *file = NULL; | ||
493 | |||
494 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
495 | if (!(flags & MAP_ANONYMOUS)) { | ||
496 | file = fget(fd); | ||
497 | if (!file) | ||
498 | return -EBADF; | ||
499 | } | ||
500 | |||
501 | down_write(&mm->mmap_sem); | ||
502 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
503 | up_write(&mm->mmap_sem); | ||
504 | |||
505 | if (file) | ||
506 | fput(file); | ||
507 | return error; | ||
508 | } | ||
509 | |||
510 | asmlinkage long sys32_olduname(struct oldold_utsname __user *name) | 469 | asmlinkage long sys32_olduname(struct oldold_utsname __user *name) |
511 | { | 470 | { |
512 | char *arch = "x86_64"; | 471 | char *arch = "x86_64"; |
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h index 9af9decb38c3..4a5a089e1c62 100644 --- a/arch/x86/include/asm/sys_ia32.h +++ b/arch/x86/include/asm/sys_ia32.h | |||
@@ -57,9 +57,6 @@ asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32); | |||
57 | asmlinkage long sys32_personality(unsigned long); | 57 | asmlinkage long sys32_personality(unsigned long); |
58 | asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); | 58 | asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); |
59 | 59 | ||
60 | asmlinkage long sys32_mmap2(unsigned long, unsigned long, unsigned long, | ||
61 | unsigned long, unsigned long, unsigned long); | ||
62 | |||
63 | struct oldold_utsname; | 60 | struct oldold_utsname; |
64 | struct old_utsname; | 61 | struct old_utsname; |
65 | asmlinkage long sys32_olduname(struct oldold_utsname __user *); | 62 | asmlinkage long sys32_olduname(struct oldold_utsname __user *); |
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 372b76edd63f..1bb6e395881c 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -55,8 +55,6 @@ struct sel_arg_struct; | |||
55 | struct oldold_utsname; | 55 | struct oldold_utsname; |
56 | struct old_utsname; | 56 | struct old_utsname; |
57 | 57 | ||
58 | asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long, | ||
59 | unsigned long, unsigned long, unsigned long); | ||
60 | asmlinkage int old_mmap(struct mmap_arg_struct __user *); | 58 | asmlinkage int old_mmap(struct mmap_arg_struct __user *); |
61 | asmlinkage int old_select(struct sel_arg_struct __user *); | 59 | asmlinkage int old_select(struct sel_arg_struct __user *); |
62 | asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); | 60 | asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); |
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c index 1884a8d12bfa..dee1ff7cba58 100644 --- a/arch/x86/kernel/sys_i386_32.c +++ b/arch/x86/kernel/sys_i386_32.c | |||
@@ -24,31 +24,6 @@ | |||
24 | 24 | ||
25 | #include <asm/syscalls.h> | 25 | #include <asm/syscalls.h> |
26 | 26 | ||
27 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
28 | unsigned long prot, unsigned long flags, | ||
29 | unsigned long fd, unsigned long pgoff) | ||
30 | { | ||
31 | int error = -EBADF; | ||
32 | struct file *file = NULL; | ||
33 | struct mm_struct *mm = current->mm; | ||
34 | |||
35 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
36 | if (!(flags & MAP_ANONYMOUS)) { | ||
37 | file = fget(fd); | ||
38 | if (!file) | ||
39 | goto out; | ||
40 | } | ||
41 | |||
42 | down_write(&mm->mmap_sem); | ||
43 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
44 | up_write(&mm->mmap_sem); | ||
45 | |||
46 | if (file) | ||
47 | fput(file); | ||
48 | out: | ||
49 | return error; | ||
50 | } | ||
51 | |||
52 | /* | 27 | /* |
53 | * Perform the select(nd, in, out, ex, tv) and mmap() system | 28 | * Perform the select(nd, in, out, ex, tv) and mmap() system |
54 | * calls. Linux/i386 didn't use to be able to handle more than | 29 | * calls. Linux/i386 didn't use to be able to handle more than |
@@ -77,7 +52,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | |||
77 | if (a.offset & ~PAGE_MASK) | 52 | if (a.offset & ~PAGE_MASK) |
78 | goto out; | 53 | goto out; |
79 | 54 | ||
80 | err = sys_mmap2(a.addr, a.len, a.prot, a.flags, | 55 | err = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, |
81 | a.fd, a.offset >> PAGE_SHIFT); | 56 | a.fd, a.offset >> PAGE_SHIFT); |
82 | out: | 57 | out: |
83 | return err; | 58 | return err; |
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 45e00eb09c3a..8aa2057efd12 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -23,26 +23,11 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, | |||
23 | unsigned long, fd, unsigned long, off) | 23 | unsigned long, fd, unsigned long, off) |
24 | { | 24 | { |
25 | long error; | 25 | long error; |
26 | struct file *file; | ||
27 | |||
28 | error = -EINVAL; | 26 | error = -EINVAL; |
29 | if (off & ~PAGE_MASK) | 27 | if (off & ~PAGE_MASK) |
30 | goto out; | 28 | goto out; |
31 | 29 | ||
32 | error = -EBADF; | 30 | error = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); |
33 | file = NULL; | ||
34 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
35 | if (!(flags & MAP_ANONYMOUS)) { | ||
36 | file = fget(fd); | ||
37 | if (!file) | ||
38 | goto out; | ||
39 | } | ||
40 | down_write(¤t->mm->mmap_sem); | ||
41 | error = do_mmap_pgoff(file, addr, len, prot, flags, off >> PAGE_SHIFT); | ||
42 | up_write(¤t->mm->mmap_sem); | ||
43 | |||
44 | if (file) | ||
45 | fput(file); | ||
46 | out: | 31 | out: |
47 | return error; | 32 | return error; |
48 | } | 33 | } |
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S index 70c2125d55b9..15228b5d3eb7 100644 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S | |||
@@ -191,7 +191,7 @@ ENTRY(sys_call_table) | |||
191 | .long sys_ni_syscall /* reserved for streams2 */ | 191 | .long sys_ni_syscall /* reserved for streams2 */ |
192 | .long ptregs_vfork /* 190 */ | 192 | .long ptregs_vfork /* 190 */ |
193 | .long sys_getrlimit | 193 | .long sys_getrlimit |
194 | .long sys_mmap2 | 194 | .long sys_mmap_pgoff |
195 | .long sys_truncate64 | 195 | .long sys_truncate64 |
196 | .long sys_ftruncate64 | 196 | .long sys_ftruncate64 |
197 | .long sys_stat64 /* 195 */ | 197 | .long sys_stat64 /* 195 */ |