Commit 16f6d167 authored by Linus Torvalds's avatar Linus Torvalds

Annotate x86 system calls with user pointer annotations.

parent 2e8d11e9
......@@ -26,7 +26,7 @@
* sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way Unix traditionally does this, though.
*/
asmlinkage int sys_pipe(unsigned long * fildes)
asmlinkage int sys_pipe(unsigned long __user * fildes)
{
int fd[2];
int error;
......@@ -88,7 +88,7 @@ struct mmap_arg_struct {
unsigned long offset;
};
asmlinkage int old_mmap(struct mmap_arg_struct *arg)
asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
{
struct mmap_arg_struct a;
int err = -EFAULT;
......@@ -106,15 +106,15 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
}
extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
extern asmlinkage int sys_select(int, fd_set __user *, fd_set __user *, fd_set __user *, struct timeval __user *);
struct sel_arg_struct {
unsigned long n;
fd_set *inp, *outp, *exp;
struct timeval *tvp;
fd_set __user *inp, *outp, *exp;
struct timeval __user *tvp;
};
asmlinkage int old_select(struct sel_arg_struct *arg)
asmlinkage int old_select(struct sel_arg_struct __user *arg)
{
struct sel_arg_struct a;
......@@ -130,7 +130,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
* This is really horribly ugly.
*/
asmlinkage int sys_ipc (uint call, int first, int second,
int third, void *ptr, long fifth)
int third, void __user *ptr, long fifth)
{
int version, ret;
......@@ -139,10 +139,10 @@ asmlinkage int sys_ipc (uint call, int first, int second,
switch (call) {
case SEMOP:
return sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
case SEMTIMEDOP:
return sys_semtimedop(first, (struct sembuf *)ptr, second,
(const struct timespec *)fifth);
return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
(const struct timespec __user *)fifth);
case SEMGET:
return sys_semget (first, second, third);
......@@ -150,13 +150,13 @@ asmlinkage int sys_ipc (uint call, int first, int second,
union semun fourth;
if (!ptr)
return -EINVAL;
if (get_user(fourth.__pad, (void **) ptr))
if (get_user(fourth.__pad, (void * __user *) ptr))
return -EFAULT;
return sys_semctl (first, second, third, fourth);
}
case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr,
return sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third);
case MSGRCV:
switch (version) {
......@@ -166,7 +166,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
return -EINVAL;
if (copy_from_user(&tmp,
(struct ipc_kludge *) ptr,
(struct ipc_kludge __user *) ptr,
sizeof (tmp)))
return -EFAULT;
return sys_msgrcv (first, tmp.msgp, second,
......@@ -174,35 +174,36 @@ asmlinkage int sys_ipc (uint call, int first, int second,
}
default:
return sys_msgrcv (first,
(struct msgbuf *) ptr,
(struct msgbuf __user *) ptr,
second, fifth, third);
}
case MSGGET:
return sys_msgget ((key_t) first, second);
case MSGCTL:
return sys_msgctl (first, second, (struct msqid_ds *) ptr);
return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
case SHMAT:
switch (version) {
default: {
ulong raddr;
ret = sys_shmat (first, (char *) ptr, second, &raddr);
ret = sys_shmat (first, (char __user *) ptr, second, &raddr);
if (ret)
return ret;
return put_user (raddr, (ulong *) third);
return put_user (raddr, (ulong __user *) third);
}
case 1: /* iBCS2 emulator entry point */
if (!segment_eq(get_fs(), get_ds()))
return -EINVAL;
return sys_shmat (first, (char *) ptr, second, (ulong *) third);
/* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
return sys_shmat (first, (char __user *) ptr, second, (ulong *) third);
}
case SHMDT:
return sys_shmdt ((char *)ptr);
return sys_shmdt ((char __user *)ptr);
case SHMGET:
return sys_shmget (first, second, third);
case SHMCTL:
return sys_shmctl (first, second,
(struct shmid_ds *) ptr);
(struct shmid_ds __user *) ptr);
default:
return -ENOSYS;
}
......@@ -211,7 +212,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
/*
* Old cruft
*/
asmlinkage int sys_uname(struct old_utsname * name)
asmlinkage int sys_uname(struct old_utsname __user * name)
{
int err;
if (!name)
......@@ -222,7 +223,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
return err?-EFAULT:0;
}
asmlinkage int sys_olduname(struct oldold_utsname * name)
asmlinkage int sys_olduname(struct oldold_utsname __user * name)
{
int error;
......
......@@ -170,7 +170,7 @@ static void mark_screen_rdonly(struct task_struct * tsk)
static int do_vm86_irq_handling(int subfunction, int irqnumber);
static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
asmlinkage int sys_vm86old(struct vm86_struct * v86)
asmlinkage int sys_vm86old(struct vm86_struct __user * v86)
{
struct kernel_vm86_struct info; /* declare this _on top_,
* this avoids wasting of stack space.
......@@ -199,7 +199,7 @@ asmlinkage int sys_vm86old(struct vm86_struct * v86)
}
asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct __user * v86)
{
struct kernel_vm86_struct info; /* declare this _on top_,
* this avoids wasting of stack space.
......@@ -239,7 +239,7 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
goto out;
info.regs32 = (struct pt_regs *) &subfunction;
info.vm86plus.is_vm86pus = 1;
tsk->thread.vm86_info = (struct vm86_struct *)v86;
tsk->thread.vm86_info = (struct vm86_struct __user *)v86;
do_sys_vm86(&info, tsk);
ret = 0; /* we never return here */
out:
......
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