Commit f6aca97d authored by David S. Miller's avatar David S. Miller

[SPARC]: __user tagging in sys_sparc.c

parent 1ca09186
...@@ -113,7 +113,7 @@ asmlinkage int sparc_pipe(struct pt_regs *regs) ...@@ -113,7 +113,7 @@ asmlinkage int sparc_pipe(struct pt_regs *regs)
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
{ {
int version, err; int version, err;
...@@ -123,7 +123,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -123,7 +123,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (call <= SEMCTL) if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semop (first, (struct sembuf *)ptr, second); err = sys_semop (first, (struct sembuf __user *)ptr, second);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget (first, second, third);
...@@ -134,7 +134,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -134,7 +134,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (!ptr) if (!ptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if(get_user(fourth.__pad, (void **)ptr)) if(get_user(fourth.__pad, (void __user **)ptr))
goto out; goto out;
err = sys_semctl (first, second, third, fourth); err = sys_semctl (first, second, third, fourth);
goto out; goto out;
...@@ -146,7 +146,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -146,7 +146,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (call <= MSGCTL) if (call <= MSGCTL)
switch (call) { switch (call) {
case MSGSND: case MSGSND:
err = sys_msgsnd (first, (struct msgbuf *) ptr, err = sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third); second, third);
goto out; goto out;
case MSGRCV: case MSGRCV:
...@@ -157,7 +157,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -157,7 +157,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (!ptr) if (!ptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if(copy_from_user(&tmp,(struct ipc_kludge *) ptr, sizeof (tmp))) if (copy_from_user(&tmp, (struct ipc_kludge __user *) ptr, sizeof (tmp)))
goto out; goto out;
err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
goto out; goto out;
...@@ -170,7 +170,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -170,7 +170,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
err = sys_msgget ((key_t) first, second); err = sys_msgget ((key_t) first, second);
goto out; goto out;
case MSGCTL: case MSGCTL:
err = sys_msgctl (first, second, (struct msqid_ds *) ptr); err = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
...@@ -182,27 +182,27 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, ...@@ -182,27 +182,27 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
switch (version) { switch (version) {
case 0: default: { case 0: default: {
ulong raddr; ulong raddr;
err = sys_shmat (first, (char *) ptr, second, &raddr); err = sys_shmat (first, (char __user *) ptr, second, &raddr);
if (err) if (err)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if(put_user (raddr, (ulong *) third)) if (put_user (raddr, (ulong __user *) third))
goto out; goto out;
err = 0; err = 0;
goto out; goto out;
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
err = sys_shmat (first, (char *) ptr, second, (ulong *) third); err = sys_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
goto out; goto out;
} }
case SHMDT: case SHMDT:
err = sys_shmdt ((char *)ptr); err = sys_shmdt ((char __user *)ptr);
goto out; goto out;
case SHMGET: case SHMGET:
err = sys_shmget (first, second, third); err = sys_shmget (first, second, third);
goto out; goto out;
case SHMCTL: case SHMCTL:
err = sys_shmctl (first, second, (struct shmid_ds *) ptr); err = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
...@@ -344,9 +344,11 @@ asmlinkage unsigned long ...@@ -344,9 +344,11 @@ asmlinkage unsigned long
c_sys_nis_syscall (struct pt_regs *regs) c_sys_nis_syscall (struct pt_regs *regs)
{ {
static int count = 0; static int count = 0;
if (count++ > 5) return -ENOSYS; if (count++ > 5)
printk ("%s[%d]: Unimplemented SPARC system call %d\n", current->comm, current->pid, (int)regs->u_regs[1]); return -ENOSYS;
printk ("%s[%d]: Unimplemented SPARC system call %d\n",
current->comm, current->pid, (int)regs->u_regs[1]);
#ifdef DEBUG_UNIMP_SYSCALL #ifdef DEBUG_UNIMP_SYSCALL
show_regs (regs); show_regs (regs);
#endif #endif
...@@ -378,8 +380,8 @@ sparc_breakpoint (struct pt_regs *regs) ...@@ -378,8 +380,8 @@ sparc_breakpoint (struct pt_regs *regs)
} }
asmlinkage int asmlinkage int
sparc_sigaction (int sig, const struct old_sigaction *act, sparc_sigaction (int sig, const struct old_sigaction __user *act,
struct old_sigaction *oact) struct old_sigaction __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -422,8 +424,11 @@ sparc_sigaction (int sig, const struct old_sigaction *act, ...@@ -422,8 +424,11 @@ sparc_sigaction (int sig, const struct old_sigaction *act,
} }
asmlinkage int asmlinkage int
sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact, sys_rt_sigaction(int sig,
void *restorer, size_t sigsetsize) const struct sigaction __user *act,
struct sigaction __user *oact,
void __user *restorer,
size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -453,7 +458,7 @@ sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact, ...@@ -453,7 +458,7 @@ sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact,
return ret; return ret;
} }
asmlinkage int sys_getdomainname(char *name, int len) asmlinkage int sys_getdomainname(char __user *name, int len)
{ {
int nlen; int nlen;
int err = -EFAULT; int err = -EFAULT;
...@@ -464,9 +469,9 @@ asmlinkage int sys_getdomainname(char *name, int len) ...@@ -464,9 +469,9 @@ asmlinkage int sys_getdomainname(char *name, int len)
if (nlen < len) if (nlen < len)
len = nlen; len = nlen;
if(len > __NEW_UTS_LEN) if (len > __NEW_UTS_LEN)
goto done; goto done;
if(copy_to_user(name, system_utsname.domainname, len)) if (copy_to_user(name, system_utsname.domainname, len))
goto done; goto done;
err = 0; err = 0;
done: done:
......
...@@ -245,9 +245,9 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir ...@@ -245,9 +245,9 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
return err; return err;
} }
extern asmlinkage int sys_newuname(struct new_utsname * name); extern asmlinkage int sys_newuname(struct new_utsname __user *name);
asmlinkage int sparc64_newuname(struct new_utsname * name) asmlinkage int sparc64_newuname(struct new_utsname __user *name)
{ {
int ret = sys_newuname(name); int ret = sys_newuname(name);
...@@ -421,7 +421,7 @@ sparc_breakpoint (struct pt_regs *regs) ...@@ -421,7 +421,7 @@ sparc_breakpoint (struct pt_regs *regs)
extern void check_pending(int signum); extern void check_pending(int signum);
asmlinkage int sys_getdomainname(char *name, int len) asmlinkage int sys_getdomainname(char __user *name, int len)
{ {
int nlen; int nlen;
int err = -EFAULT; int err = -EFAULT;
...@@ -432,9 +432,9 @@ asmlinkage int sys_getdomainname(char *name, int len) ...@@ -432,9 +432,9 @@ asmlinkage int sys_getdomainname(char *name, int len)
if (nlen < len) if (nlen < len)
len = nlen; len = nlen;
if(len > __NEW_UTS_LEN) if (len > __NEW_UTS_LEN)
goto done; goto done;
if(copy_to_user(name, system_utsname.domainname, len)) if (copy_to_user(name, system_utsname.domainname, len))
goto done; goto done;
err = 0; err = 0;
done: done:
...@@ -458,7 +458,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs) ...@@ -458,7 +458,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs)
regs->tpc &= 0xffffffff; regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
if(++count <= 5) { if (++count <= 5) {
printk ("For Solaris binary emulation you need solaris module loaded\n"); printk ("For Solaris binary emulation you need solaris module loaded\n");
show_regs (regs); show_regs (regs);
} }
...@@ -478,7 +478,7 @@ asmlinkage int sunos_syscall(struct pt_regs *regs) ...@@ -478,7 +478,7 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
regs->tpc &= 0xffffffff; regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
if(++count <= 20) if (++count <= 20)
printk ("SunOS binary emulation not compiled in\n"); printk ("SunOS binary emulation not compiled in\n");
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
...@@ -486,9 +486,11 @@ asmlinkage int sunos_syscall(struct pt_regs *regs) ...@@ -486,9 +486,11 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
} }
#endif #endif
asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p, asmlinkage int sys_utrap_install(utrap_entry_t type,
utrap_handler_t new_p,
utrap_handler_t new_d, utrap_handler_t new_d,
utrap_handler_t *old_p, utrap_handler_t *old_d) utrap_handler_t __user *old_p,
utrap_handler_t __user *old_d)
{ {
if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31) if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31)
return -EINVAL; return -EINVAL;
...@@ -511,9 +513,11 @@ asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p, ...@@ -511,9 +513,11 @@ asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p,
if (!current_thread_info()->utraps) { if (!current_thread_info()->utraps) {
current_thread_info()->utraps = current_thread_info()->utraps =
kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL); kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
if (!current_thread_info()->utraps) return -ENOMEM; if (!current_thread_info()->utraps)
return -ENOMEM;
current_thread_info()->utraps[0] = 1; current_thread_info()->utraps[0] = 1;
memset(current_thread_info()->utraps+1, 0, UT_TRAP_INSTRUCTION_31*sizeof(long)); memset(current_thread_info()->utraps+1, 0,
UT_TRAP_INSTRUCTION_31*sizeof(long));
} else { } else {
if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p && if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p &&
current_thread_info()->utraps[0] > 1) { current_thread_info()->utraps[0] > 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment