aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/linux32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r--arch/mips/kernel/linux32.c99
1 files changed, 3 insertions, 96 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index b77fefaff9da..c2dab140dc98 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -9,14 +9,12 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/file.h> 11#include <linux/file.h>
12#include <linux/smp_lock.h>
13#include <linux/highuid.h> 12#include <linux/highuid.h>
14#include <linux/resource.h> 13#include <linux/resource.h>
15#include <linux/highmem.h> 14#include <linux/highmem.h>
16#include <linux/time.h> 15#include <linux/time.h>
17#include <linux/times.h> 16#include <linux/times.h>
18#include <linux/poll.h> 17#include <linux/poll.h>
19#include <linux/slab.h>
20#include <linux/skbuff.h> 18#include <linux/skbuff.h>
21#include <linux/filter.h> 19#include <linux/filter.h>
22#include <linux/shm.h> 20#include <linux/shm.h>
@@ -35,6 +33,7 @@
35#include <linux/compat.h> 33#include <linux/compat.h>
36#include <linux/vfs.h> 34#include <linux/vfs.h>
37#include <linux/ipc.h> 35#include <linux/ipc.h>
36#include <linux/slab.h>
38 37
39#include <net/sock.h> 38#include <net/sock.h>
40#include <net/scm.h> 39#include <net/scm.h>
@@ -67,28 +66,13 @@ SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
67 unsigned long, prot, unsigned long, flags, unsigned long, fd, 66 unsigned long, prot, unsigned long, flags, unsigned long, fd,
68 unsigned long, pgoff) 67 unsigned long, pgoff)
69{ 68{
70 struct file * file = NULL;
71 unsigned long error; 69 unsigned long error;
72 70
73 error = -EINVAL; 71 error = -EINVAL;
74 if (pgoff & (~PAGE_MASK >> 12)) 72 if (pgoff & (~PAGE_MASK >> 12))
75 goto out; 73 goto out;
76 pgoff >>= PAGE_SHIFT-12; 74 error = sys_mmap_pgoff(addr, len, prot, flags, fd,
77 75 pgoff >> (PAGE_SHIFT-12));
78 if (!(flags & MAP_ANONYMOUS)) {
79 error = -EBADF;
80 file = fget(fd);
81 if (!file)
82 goto out;
83 }
84 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
85
86 down_write(&current->mm->mmap_sem);
87 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
88 up_write(&current->mm->mmap_sem);
89 if (file)
90 fput(file);
91
92out: 76out:
93 return error; 77 return error;
94} 78}
@@ -265,83 +249,6 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
265} 249}
266#endif 250#endif
267 251
268struct sysctl_args32
269{
270 compat_caddr_t name;
271 int nlen;
272 compat_caddr_t oldval;
273 compat_caddr_t oldlenp;
274 compat_caddr_t newval;
275 compat_size_t newlen;
276 unsigned int __unused[4];
277};
278
279#ifdef CONFIG_SYSCTL_SYSCALL
280
281SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
282{
283 struct sysctl_args32 tmp;
284 int error;
285 size_t oldlen;
286 size_t __user *oldlenp = NULL;
287 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
288
289 if (copy_from_user(&tmp, args, sizeof(tmp)))
290 return -EFAULT;
291
292 if (tmp.oldval && tmp.oldlenp) {
293 /* Duh, this is ugly and might not work if sysctl_args
294 is in read-only memory, but do_sysctl does indirectly
295 a lot of uaccess in both directions and we'd have to
296 basically copy the whole sysctl.c here, and
297 glibc's __sysctl uses rw memory for the structure
298 anyway. */
299 if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
300 put_user(oldlen, (size_t __user *)addr))
301 return -EFAULT;
302 oldlenp = (size_t __user *)addr;
303 }
304
305 lock_kernel();
306 error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
307 oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
308 unlock_kernel();
309 if (oldlenp) {
310 if (!error) {
311 if (get_user(oldlen, (size_t __user *)addr) ||
312 put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
313 error = -EFAULT;
314 }
315 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
316 }
317 return error;
318}
319
320#else
321
322SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
323{
324 return -ENOSYS;
325}
326
327#endif /* CONFIG_SYSCTL_SYSCALL */
328
329SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name)
330{
331 int ret = 0;
332
333 down_read(&uts_sem);
334 if (copy_to_user(name, utsname(), sizeof *name))
335 ret = -EFAULT;
336 up_read(&uts_sem);
337
338 if (current->personality == PER_LINUX32 && !ret)
339 if (copy_to_user(name->machine, "mips\0\0\0", 8))
340 ret = -EFAULT;
341
342 return ret;
343}
344
345SYSCALL_DEFINE1(32_personality, unsigned long, personality) 252SYSCALL_DEFINE1(32_personality, unsigned long, personality)
346{ 253{
347 int ret; 254 int ret;