diff options
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 6 | ||||
-rw-r--r-- | arch/mips/kernel/gdb-low.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/linux32.c | 180 | ||||
-rw-r--r-- | arch/mips/kernel/proc.c | 1 | ||||
-rw-r--r-- | arch/mips/kernel/process.c | 16 | ||||
-rw-r--r-- | arch/mips/kernel/setup.c | 11 | ||||
-rw-r--r-- | arch/mips/kernel/signal-common.h | 10 | ||||
-rw-r--r-- | arch/mips/kernel/signal.c | 6 | ||||
-rw-r--r-- | arch/mips/kernel/signal32.c | 46 | ||||
-rw-r--r-- | arch/mips/kernel/signal_n32.c | 5 | ||||
-rw-r--r-- | arch/mips/kernel/syscall.c | 7 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 2 |
12 files changed, 136 insertions, 156 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 292f8b243a5..58b3b14873c 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -291,7 +291,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c) * for documentation. Commented out because it shares * it's c0_prid id number with the TX3900. */ - c->cputype = CPU_R4650; + c->cputype = CPU_R4650; c->isa_level = MIPS_CPU_ISA_III; c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; c->tlbsize = 48; @@ -604,7 +604,7 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c) case PRID_IMP_AU1_REV2: switch ((c->processor_id >> 24) & 0xff) { case 0: - c->cputype = CPU_AU1000; + c->cputype = CPU_AU1000; break; case 1: c->cputype = CPU_AU1500; @@ -705,7 +705,7 @@ __init void cpu_probe(void) break; case PRID_COMP_PHILIPS: cpu_probe_philips(c); - break; + break; default: c->cputype = CPU_UNKNOWN; } diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S index 83b8986f940..235ad9f6bd3 100644 --- a/arch/mips/kernel/gdb-low.S +++ b/arch/mips/kernel/gdb-low.S @@ -41,7 +41,7 @@ */ .align 5 NESTED(trap_low, GDB_FR_SIZE, sp) - .set noat + .set noat .set noreorder mfc0 k0, CP0_STATUS diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index e00e5f6e7fd..013bc93688e 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -69,7 +69,7 @@ * Revalidate the inode. This is required for proper NFS attribute caching. */ -int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) +int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) { struct compat_stat tmp; @@ -106,6 +106,10 @@ sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long error; error = -EINVAL; + if (pgoff & (~PAGE_MASK >> 12)) + goto out; + pgoff >>= PAGE_SHIFT-12; + if (!(flags & MAP_ANONYMOUS)) { error = -EBADF; file = fget(fd); @@ -125,7 +129,7 @@ out: } -asmlinkage int sys_truncate64(const char *path, unsigned int high, +asmlinkage int sys_truncate64(const char __user *path, unsigned int high, unsigned int low) { if ((int)high < 0) @@ -161,12 +165,6 @@ out: return error; } -asmlinkage int -sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) -{ - return compat_sys_wait4(pid, stat_addr, options, NULL); -} - asmlinkage long sysn32_waitid(int which, compat_pid_t pid, siginfo_t __user *uinfo, int options, @@ -175,6 +173,7 @@ sysn32_waitid(int which, compat_pid_t pid, struct rusage ru; long ret; mm_segment_t old_fs = get_fs(); + int si_signo; if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo))) return -EFAULT; @@ -184,7 +183,9 @@ sysn32_waitid(int which, compat_pid_t pid, uru ? (struct rusage __user *) &ru : NULL); set_fs (old_fs); - if (ret < 0 || uinfo->si_signo == 0) + if (__get_user(si_signo, &uinfo->si_signo)) + return -EFAULT; + if (ret < 0 || si_signo == 0) return ret; if (uru) @@ -208,14 +209,14 @@ struct sysinfo32 { char _f[8]; }; -asmlinkage int sys32_sysinfo(struct sysinfo32 *info) +asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) { struct sysinfo s; int ret, err; mm_segment_t old_fs = get_fs (); set_fs (KERNEL_DS); - ret = sys_sysinfo(&s); + ret = sys_sysinfo((struct sysinfo __user *)&s); set_fs (old_fs); err = put_user (s.uptime, &info->uptime); err |= __put_user (s.loads[0], &info->loads[0]); @@ -245,11 +246,11 @@ struct rlimit32 { }; #ifdef __MIPSEB__ -asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy, +asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy, int length_hi, int length_lo) #endif #ifdef __MIPSEL__ -asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy, +asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy, int length_lo, int length_hi) #endif { @@ -277,7 +278,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy, } static inline long -get_tv32(struct timeval *o, struct compat_timeval *i) +get_tv32(struct timeval *o, struct compat_timeval __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | @@ -285,7 +286,7 @@ get_tv32(struct timeval *o, struct compat_timeval *i) } static inline long -put_tv32(struct compat_timeval *o, struct timeval *i) +put_tv32(struct compat_timeval __user *o, struct timeval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->tv_sec, &o->tv_sec) | @@ -295,7 +296,7 @@ put_tv32(struct compat_timeval *o, struct timeval *i) extern struct timezone sys_tz; asmlinkage int -sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { if (tv) { struct timeval ktv; @@ -310,7 +311,7 @@ sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) return 0; } -static inline long get_ts32(struct timespec *o, struct compat_timeval *i) +static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) { long usec; @@ -325,7 +326,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i) } asmlinkage int -sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { struct timespec kts; struct timezone ktz; @@ -343,7 +344,7 @@ sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) } asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, - unsigned int offset_low, loff_t * result, + unsigned int offset_low, loff_t __user * result, unsigned int origin) { return sys_llseek(fd, offset_high, offset_low, result, origin); @@ -353,12 +354,12 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, lseek back to original location. They fail just like lseek does on non-seekable files. */ -asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf, +asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, size_t count, u32 unused, u64 a4, u64 a5) { ssize_t ret; struct file * file; - ssize_t (*read)(struct file *, char *, size_t, loff_t *); + ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); loff_t pos; ret = -EBADF; @@ -388,12 +389,12 @@ bad_file: return ret; } -asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf, +asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, size_t count, u32 unused, u64 a4, u64 a5) { ssize_t ret; struct file * file; - ssize_t (*write)(struct file *, const char *, size_t, loff_t *); + ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); loff_t pos; ret = -EBADF; @@ -426,14 +427,14 @@ bad_file: } asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, - struct compat_timespec *interval) + struct compat_timespec __user *interval) { struct timespec t; int ret; mm_segment_t old_fs = get_fs (); set_fs (KERNEL_DS); - ret = sys_sched_rr_get_interval(pid, &t); + ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t); set_fs (old_fs); if (put_user (t.tv_sec, &interval->tv_sec) || __put_user (t.tv_nsec, &interval->tv_nsec)) @@ -551,7 +552,7 @@ struct ipc_kludge32 { }; static int -do_sys32_semctl(int first, int second, int third, void *uptr) +do_sys32_semctl(int first, int second, int third, void __user *uptr) { union semun fourth; u32 pad; @@ -562,12 +563,12 @@ do_sys32_semctl(int first, int second, int third, void *uptr) if (!uptr) return -EINVAL; err = -EFAULT; - if (get_user (pad, (u32 *)uptr)) + if (get_user (pad, (u32 __user *)uptr)) return err; if ((third & ~IPC_64) == SETVAL) fourth.val = (int)pad; else - fourth.__pad = (void *)A(pad); + fourth.__pad = (void __user *)A(pad); switch (third & ~IPC_64) { case IPC_INFO: case IPC_RMID: @@ -585,14 +586,14 @@ do_sys32_semctl(int first, int second, int third, void *uptr) case IPC_STAT: case SEM_STAT: - fourth.__pad = &s; + fourth.__pad = (struct semid64_ds __user *)&s; old_fs = get_fs(); set_fs(KERNEL_DS); err = sys_semctl(first, second, third | IPC_64, fourth); set_fs(old_fs); if (third & IPC_64) { - struct semid64_ds32 *usp64 = (struct semid64_ds32 *) A(pad); + struct semid64_ds32 __user *usp64 = (struct semid64_ds32 __user *) A(pad); if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) { err = -EFAULT; @@ -609,7 +610,7 @@ do_sys32_semctl(int first, int second, int third, void *uptr) err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime); err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems); } else { - struct semid_ds32 *usp32 = (struct semid_ds32 *) A(pad); + struct semid_ds32 __user *usp32 = (struct semid_ds32 __user *) A(pad); if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) { err = -EFAULT; @@ -639,9 +640,9 @@ do_sys32_semctl(int first, int second, int third, void *uptr) } static int -do_sys32_msgsnd (int first, int second, int third, void *uptr) +do_sys32_msgsnd (int first, int second, int third, void __user *uptr) { - struct msgbuf32 *up = (struct msgbuf32 *)uptr; + struct msgbuf32 __user *up = (struct msgbuf32 __user *)uptr; struct msgbuf *p; mm_segment_t old_fs; int err; @@ -660,7 +661,7 @@ do_sys32_msgsnd (int first, int second, int third, void *uptr) goto out; old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgsnd (first, p, second, third); + err = sys_msgsnd (first, (struct msgbuf __user *)p, second, third); set_fs (old_fs); out: kfree (p); @@ -670,15 +671,15 @@ out: static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, - int version, void *uptr) + int version, void __user *uptr) { - struct msgbuf32 *up; + struct msgbuf32 __user *up; struct msgbuf *p; mm_segment_t old_fs; int err; if (!version) { - struct ipc_kludge32 *uipck = (struct ipc_kludge32 *)uptr; + struct ipc_kludge32 __user *uipck = (struct ipc_kludge32 __user *)uptr; struct ipc_kludge32 ipck; err = -EINVAL; @@ -687,7 +688,7 @@ do_sys32_msgrcv (int first, int second, int msgtyp, int third, err = -EFAULT; if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32))) goto out; - uptr = (void *)AA(ipck.msgp); + uptr = (void __user *)AA(ipck.msgp); msgtyp = ipck.msgtyp; } @@ -699,11 +700,11 @@ do_sys32_msgrcv (int first, int second, int msgtyp, int third, goto out; old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgrcv (first, p, second + 4, msgtyp, third); + err = sys_msgrcv (first, (struct msgbuf __user *)p, second + 4, msgtyp, third); set_fs (old_fs); if (err < 0) goto free_then_out; - up = (struct msgbuf32 *)uptr; + up = (struct msgbuf32 __user *)uptr; if (put_user (p->mtype, &up->mtype) || __copy_to_user (&up->mtext, p->mtext, err)) err = -EFAULT; @@ -714,19 +715,19 @@ out: } static int -do_sys32_msgctl (int first, int second, void *uptr) +do_sys32_msgctl (int first, int second, void __user *uptr) { int err = -EINVAL, err2; struct msqid64_ds m; - struct msqid_ds32 *up32 = (struct msqid_ds32 *)uptr; - struct msqid64_ds32 *up64 = (struct msqid64_ds32 *)uptr; + struct msqid_ds32 __user *up32 = (struct msqid_ds32 __user *)uptr; + struct msqid64_ds32 __user *up64 = (struct msqid64_ds32 __user *)uptr; mm_segment_t old_fs; switch (second & ~IPC_64) { case IPC_INFO: case IPC_RMID: case MSG_INFO: - err = sys_msgctl (first, second, (struct msqid_ds *)uptr); + err = sys_msgctl (first, second, (struct msqid_ds __user *)uptr); break; case IPC_SET: @@ -753,7 +754,7 @@ do_sys32_msgctl (int first, int second, void *uptr) break; old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m); + err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m); set_fs(old_fs); break; @@ -761,7 +762,7 @@ do_sys32_msgctl (int first, int second, void *uptr) case MSG_STAT: old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m); + err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m); set_fs(old_fs); if (second & IPC_64) { if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) { @@ -815,10 +816,10 @@ do_sys32_msgctl (int first, int second, void *uptr) } static int -do_sys32_shmat (int first, int second, int third, int version, void *uptr) +do_sys32_shmat (int first, int second, int third, int version, void __user *uptr) { unsigned long raddr; - u32 *uaddr = (u32 *)A((u32)third); + u32 __user *uaddr = (u32 __user *)A((u32)third); int err = -EINVAL; if (version == 1) @@ -837,11 +838,11 @@ struct shm_info32 { }; static int -do_sys32_shmctl (int first, int second, void *uptr) +do_sys32_shmctl (int first, int second, void __user *uptr) { - struct shmid64_ds32 *up64 = (struct shmid64_ds32 *)uptr; - struct shmid_ds32 *up32 = (struct shmid_ds32 *)uptr; - struct shm_info32 *uip = (struct shm_info32 *)uptr; + struct shmid64_ds32 __user *up64 = (struct shmid64_ds32 __user *)uptr; + struct shmid_ds32 __user *up32 = (struct shmid_ds32 __user *)uptr; + struct shm_info32 __user *uip = (struct shm_info32 __user *)uptr; int err = -EFAULT, err2; struct shmid64_ds s64; mm_segment_t old_fs; @@ -854,7 +855,7 @@ do_sys32_shmctl (int first, int second, void *uptr) case IPC_RMID: case SHM_LOCK: case SHM_UNLOCK: - err = sys_shmctl(first, second, (struct shmid_ds *)uptr); + err = sys_shmctl(first, second, (struct shmid_ds __user *)uptr); break; case IPC_SET: if (second & IPC_64) { @@ -870,7 +871,7 @@ do_sys32_shmctl (int first, int second, void *uptr) break; old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_shmctl(first, second & ~IPC_64, &s); + err = sys_shmctl(first, second & ~IPC_64, (struct shmid_ds __user *)&s); set_fs(old_fs); break; @@ -878,7 +879,7 @@ do_sys32_shmctl (int first, int second, void *uptr) case SHM_STAT: old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_shmctl(first, second | IPC_64, (void *) &s64); + err = sys_shmctl(first, second | IPC_64, (void __user *) &s64); set_fs(old_fs); if (err < 0) break; @@ -928,7 +929,7 @@ do_sys32_shmctl (int first, int second, void *uptr) case SHM_INFO: old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_shmctl(first, second, (void *)&si); + err = sys_shmctl(first, second, (void __user *)&si); set_fs(old_fs); if (err < 0) break; @@ -950,11 +951,11 @@ do_sys32_shmctl (int first, int second, void *uptr) return err; } -static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems, - const struct compat_timespec *timeout32) +static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, + const struct compat_timespec __user *timeout32) { struct compat_timespec t32; - struct timespec *t64 = compat_alloc_user_space(sizeof(*t64)); + struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64)); if (copy_from_user(&t32, timeout32, sizeof(t32))) return -EFAULT; @@ -977,11 +978,11 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) switch (call) { case SEMOP: /* struct sembuf is the same on 32 and 64bit :)) */ - err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, + err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, NULL); break; case SEMTIMEDOP: - err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, + err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, (const struct compat_timespec __user *)AA(fifth)); break; case SEMGET: @@ -989,36 +990,36 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) break; case SEMCTL: err = do_sys32_semctl (first, second, third, - (void *)AA(ptr)); + (void __user *)AA(ptr)); break; case MSGSND: err = do_sys32_msgsnd (first, second, third, - (void *)AA(ptr)); + (void __user *)AA(ptr)); break; case MSGRCV: err = do_sys32_msgrcv (first, second, fifth, third, - version, (void *)AA(ptr)); + version, (void __user *)AA(ptr)); break; case MSGGET: err = sys_msgget ((key_t) first, second); break; case MSGCTL: - err = do_sys32_msgctl (first, second, (void *)AA(ptr)); + err = do_sys32_msgctl (first, second, (void __user *)AA(ptr)); break; case SHMAT: err = do_sys32_shmat (first, second, third, - version, (void *)AA(ptr)); + version, (void __user *)AA(ptr)); break; case SHMDT: - err = sys_shmdt ((char *)A(ptr)); + err = sys_shmdt ((char __user *)A(ptr)); break; case SHMGET: err = sys_shmget (first, (unsigned)second, third); break; case SHMCTL: - err = do_sys32_shmctl (first, second, (void *)AA(ptr)); + err = do_sys32_shmctl (first, second, (void __user *)AA(ptr)); break; default: err = -EINVAL; @@ -1029,7 +1030,7 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) } asmlinkage long sys32_shmat(int shmid, char __user *shmaddr, - int shmflg, int32_t *addr) + int shmflg, int32_t __user *addr) { unsigned long raddr; int err; @@ -1054,12 +1055,13 @@ struct sysctl_args32 #ifdef CONFIG_SYSCTL -asmlinkage long sys32_sysctl(struct sysctl_args32 *args) +asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args) { struct sysctl_args32 tmp; int error; - size_t oldlen, *oldlenp = NULL; - unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; + size_t oldlen; + size_t __user *oldlenp = NULL; + unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; @@ -1071,20 +1073,20 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 *args) basically copy the whole sysctl.c here, and glibc's __sysctl uses rw memory for the structure anyway. */ - if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || - put_user(oldlen, (size_t *)addr)) + if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || + put_user(oldlen, (size_t __user *)addr)) return -EFAULT; - oldlenp = (size_t *)addr; + oldlenp = (size_t __user *)addr; } lock_kernel(); - error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), - oldlenp, (void *)A(tmp.newval), tmp.newlen); + error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), + oldlenp, (void __user *)A(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { - if (get_user(oldlen, (size_t *)addr) || - put_user(oldlen, (u32 *)A(tmp.oldlenp))) + if (get_user(oldlen, (size_t __user *)addr) || + put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); @@ -1094,7 +1096,7 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 *args) #endif /* CONFIG_SYSCTL */ -asmlinkage long sys32_newuname(struct new_utsname * name) +asmlinkage long sys32_newuname(struct new_utsname __user * name) { int ret = 0; @@ -1129,9 +1131,9 @@ struct ustat32 { char f_fpack[6]; }; -extern asmlinkage long sys_ustat(dev_t dev, struct ustat * ubuf); +extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf); -asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32) +asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32) { int err; struct ustat tmp; @@ -1139,7 +1141,7 @@ asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32) mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - err = sys_ustat(dev, &tmp); + err = sys_ustat(dev, (struct ustat __user *)&tmp); set_fs (old_fs); if (err) @@ -1172,7 +1174,7 @@ struct timex32 { extern int do_adjtimex(struct timex *); -asmlinkage int sys32_adjtimex(struct timex32 *utp) +asmlinkage int sys32_adjtimex(struct timex32 __user *utp) { struct timex txc; int ret; @@ -1228,7 +1230,7 @@ asmlinkage int sys32_adjtimex(struct timex32 *utp) return ret; } -asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, +asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -1239,7 +1241,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, return -EFAULT; set_fs(KERNEL_DS); - ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); + ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count); set_fs(old_fs); if (offset && put_user(of, offset)) @@ -1269,7 +1271,7 @@ static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), * it is set by the callees. */ -asmlinkage long sys32_socketcall(int call, unsigned int *args32) +asmlinkage long sys32_socketcall(int call, unsigned int __user *args32) { unsigned int a[6]; unsigned int a0,a1; @@ -1291,7 +1293,7 @@ asmlinkage long sys32_socketcall(int call, unsigned int *args32) struct sockaddr __user *addr, int __user *addr_len); extern asmlinkage long sys_shutdown(int fd, int how); extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen); - extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int *optlen); + extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen); extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags); @@ -1411,7 +1413,7 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs) newsp = regs.regs[5]; if (!newsp) newsp = regs.regs[29]; - parent_tidptr = (int *) regs.regs[6]; + parent_tidptr = (int __user *) regs.regs[6]; /* Use __dummy4 instead of getting it off the stack, so that syscall() works. */ diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 86fe15b273c..84ab959f924 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -135,6 +135,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) cpu_has_vce ? "%u" : "not available"); seq_printf(m, fmt, 'D', vced_count); seq_printf(m, fmt, 'I', vcei_count); + seq_printf(m, "\n"); return 0; } diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 092679c2dca..a8f435d8294 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -60,17 +60,9 @@ ATTRIB_NORET void cpu_idle(void) } } -extern void do_signal(struct pt_regs *regs); -extern void do_signal32(struct pt_regs *regs); - /* * Native o32 and N64 ABI without DSP ASE */ -extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, - int signr, sigset_t *set); -extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, - int signr, sigset_t *set, siginfo_t *info); - struct mips_abi mips_abi = { .do_signal = do_signal, #ifdef CONFIG_TRAD_SIGNALS @@ -83,11 +75,6 @@ struct mips_abi mips_abi = { /* * o32 compatibility on 64-bit kernels, without DSP ASE */ -extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, - int signr, sigset_t *set); -extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, - int signr, sigset_t *set, siginfo_t *info); - struct mips_abi mips_abi_32 = { .do_signal = do_signal32, .setup_frame = setup_frame_32, @@ -99,9 +86,6 @@ struct mips_abi mips_abi_32 = { /* * N32 on 64-bit kernels, without DSP ASE */ -extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs, - int signr, sigset_t *set, siginfo_t *info); - struct mips_abi mips_abi_n32 = { .do_signal = do_signal, .setup_rt_frame = setup_rt_frame_n32 diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index d9293c558e4..0cb3b6097e0 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -447,21 +447,10 @@ static inline void resource_init(void) { int i; -#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) - /* - * The 64bit code in 32bit object format trick can't represent - * 64bit wide relocations for linker script symbols. - */ - code_resource.start = CPHYSADDR(&_text); - code_resource.end = CPHYSADDR(&_etext) - 1; - data_resource.start = CPHYSADDR(&_etext); - data_resource.end = CPHYSADDR(&_edata) - 1; -#else code_resource.start = virt_to_phys(&_text); code_resource.end = virt_to_phys(&_etext) - 1; data_resource.start = virt_to_phys(&_etext); data_resource.end = virt_to_phys(&_edata) - 1; -#endif /* * Request address space for all standard RAM. diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index 36bfc2588aa..3ca786215d4 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h @@ -166,11 +166,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) sp = regs->regs[29]; /* - * FPU emulator may have it's own trampoline active just - * above the user stack, 16-bytes before the next lowest - * 16 byte boundary. Try to avoid trashing it. - */ - sp -= 32; + * FPU emulator may have it's own trampoline active just + * above the user stack, 16-bytes before the next lowest + * 16 byte boundary. Try to avoid trashing it. + */ + sp -= 32; /* This is the X/Open sanctioned signal stack switching. */ if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index c974cc9b30e..402efd27c79 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c @@ -100,8 +100,8 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) } #ifdef CONFIG_TRAD_SIGNALS -asmlinkage int sys_sigaction(int sig, const struct sigaction *act, - struct sigaction *oact) +asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act, + struct sigaction __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -331,7 +331,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, /* Create the ucontext. */ err |= __put_user(0, &frame->rs_uc.uc_flags); err |= __put_user(NULL, &frame->rs_uc.uc_link); - err |= __put_user((void *)current->sas_ss_sp, + err |= __put_user((void __user *)current->sas_ss_sp, &frame->rs_uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(regs->regs[29]), &frame->rs_uc.uc_stack.ss_flags); diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 237cd8a2cd3..f32a22997c3 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c @@ -163,7 +163,7 @@ static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf) return err; } -static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf) +static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf) { int err = 0; unsigned long sig[4]; @@ -195,10 +195,10 @@ save_static_function(sys32_sigsuspend); __attribute_used__ noinline static int _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) { - compat_sigset_t *uset; + compat_sigset_t __user *uset; sigset_t newset; - uset = (compat_sigset_t *) regs.regs[4]; + uset = (compat_sigset_t __user *) regs.regs[4]; if (get_sigset(&newset, uset)) return -EFAULT; sigdelsetmask(&newset, ~_BLOCKABLE); @@ -219,7 +219,7 @@ save_static_function(sys32_rt_sigsuspend); __attribute_used__ noinline static int _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) { - compat_sigset_t *uset; + compat_sigset_t __user *uset; sigset_t newset; size_t sigsetsize; @@ -228,7 +228,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) if (sigsetsize != sizeof(compat_sigset_t)) return -EINVAL; - uset = (compat_sigset_t *) regs.regs[4]; + uset = (compat_sigset_t __user *) regs.regs[4]; if (get_sigset(&newset, uset)) return -EFAULT; sigdelsetmask(&newset, ~_BLOCKABLE); @@ -236,7 +236,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) spin_lock_irq(¤t->sighand->siglock); current->saved_sigmask = current->blocked; current->blocked = newset; - recalc_sigpending(); + recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); current->state = TASK_INTERRUPTIBLE; @@ -245,8 +245,8 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) return -ERESTARTNOHAND; } -asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, - struct sigaction32 *oact) +asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act, + struct sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -272,15 +272,15 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, if (!ret && oact) { if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) - return -EFAULT; + return -EFAULT; err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); err |= __put_user((u32)(u64)old_ka.sa.sa_handler, &oact->sa_handler); err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig); - err |= __put_user(0, &oact->sa_mask.sig[1]); - err |= __put_user(0, &oact->sa_mask.sig[2]); - err |= __put_user(0, &oact->sa_mask.sig[3]); - if (err) + err |= __put_user(0, &oact->sa_mask.sig[1]); + err |= __put_user(0, &oact->sa_mask.sig[2]); + err |= __put_user(0, &oact->sa_mask.sig[3]); + if (err) return -EFAULT; } @@ -301,7 +301,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) return -EFAULT; err |= __get_user(sp, &uss->ss_sp); - kss.ss_sp = (void *) (long) sp; + kss.ss_sp = (void __user *) (long) sp; err |= __get_user(kss.ss_size, &uss->ss_size); err |= __get_user(kss.ss_flags, &uss->ss_flags); if (err) @@ -316,7 +316,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) if (!ret && uoss) { if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) return -EFAULT; - sp = (int) (long) koss.ss_sp; + sp = (int) (unsigned long) koss.ss_sp; err |= __put_user(sp, &uoss->ss_sp); err |= __put_user(koss.ss_size, &uoss->ss_size); err |= __put_user(koss.ss_flags, &uoss->ss_flags); @@ -527,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) /* The ucontext contains a stack32_t, so we must convert! */ if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) goto badframe; - st.ss_sp = (void *)(long) sp; + st.ss_sp = (void __user *)(long) sp; if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) goto badframe; if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) @@ -624,11 +624,11 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, sp = regs->regs[29]; /* - * FPU emulator may have it's own trampoline active just - * above the user stack, 16-bytes before the next lowest - * 16 byte boundary. Try to avoid trashing it. - */ - sp -= 32; + * FPU emulator may have it's own trampoline active just + * above the user stack, 16-bytes before the next lowest + * 16 byte boundary. Try to avoid trashing it. + */ + sp -= 32; /* This is the X/Open sanctioned signal stack switching. */ if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) @@ -868,7 +868,7 @@ no_signal: } } -asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, +asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigaction32 __user *oact, unsigned int sigsetsize) { @@ -912,7 +912,7 @@ out: return ret; } -asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, +asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, unsigned int sigsetsize) { sigset_t old_set, new_set; diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index 3e168c08a3a..477c5334ec1 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c @@ -87,7 +87,8 @@ save_static_function(sysn32_rt_sigsuspend); __attribute_used__ noinline static int _sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) { - compat_sigset_t __user *unewset, uset; + compat_sigset_t __user *unewset; + compat_sigset_t uset; size_t sigsetsize; sigset_t newset; @@ -141,7 +142,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) /* The ucontext contains a stack32_t, so we must convert! */ if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) goto badframe; - st.ss_sp = (void *)(long) sp; + st.ss_sp = (void __user *)(long) sp; if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) goto badframe; if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 1da2eeb3ef9..2aeaa2fd4b3 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -162,7 +162,10 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { - return do_mmap2(addr, len, prot, flags, fd, pgoff); + if (pgoff & (~PAGE_MASK >> 12)) + return -EINVAL; + + return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12)); } save_static_function(sys_fork); @@ -345,7 +348,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, union semun fourth; if (!ptr) return -EINVAL; - if (get_user(fourth.__pad, (void *__user *) ptr)) + if (get_user(fourth.__pad, (void __user *__user *) ptr)) return -EFAULT; return sys_semctl (first, second, third, fourth); } diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 005debbfbe8..bed0eb6cf55 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -576,7 +576,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) } #endif /* - * Unimplemented operation exception. If we've got the full + * Unimplemented operation exception. If we've got the full * software emulator on-board, let's use it... * * Force FPU to dump state into task/thread context. We're |