* actually access the pt_regs stored on the kernel stack.
*/
static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
- unsigned long *ret)
+ unsigned long __user *ret)
{
unsigned long tmp;
/*
* Get all user integer registers.
*/
-static int ptrace_getregs(struct task_struct *tsk, void *uregs)
+static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
{
struct pt_regs *regs = get_user_regs(tsk);
/*
* Set all user integer registers.
*/
-static int ptrace_setregs(struct task_struct *tsk, void *uregs)
+static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
{
struct pt_regs newregs;
int ret;
/*
* Get the child FPU state.
*/
-static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
+static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp)
{
return copy_to_user(ufp, &tsk->thread_info->fpstate,
sizeof(struct user_fp)) ? -EFAULT : 0;
/*
* Set the child FPU state.
*/
-static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
+static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
{
struct thread_info *thread = tsk->thread_info;
thread->used_cp[1] = thread->used_cp[2] = 1;
break;
case PTRACE_PEEKUSR:
- ret = ptrace_read_user(child, addr, (unsigned long *)data);
+ ret = ptrace_read_user(child, addr, (unsigned long __user *)data);
break;
/*
break;
case PTRACE_GETREGS:
- ret = ptrace_getregs(child, (void *)data);
+ ret = ptrace_getregs(child, (void __user *)data);
break;
case PTRACE_SETREGS:
- ret = ptrace_setregs(child, (void *)data);
+ ret = ptrace_setregs(child, (void __user *)data);
break;
case PTRACE_GETFPREGS:
- ret = ptrace_getfpregs(child, (void *)data);
+ ret = ptrace_getfpregs(child, (void __user *)data);
break;
case PTRACE_SETFPREGS:
- ret = ptrace_setfpregs(child, (void *)data);
+ ret = ptrace_setfpregs(child, (void __user *)data);
break;
default:
}
asmlinkage int
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
+sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
{
sigset_t saveset, newset;
}
asmlinkage int
-sys_sigaction(int sig, const struct old_sigaction *act,
- struct old_sigaction *oact)
+sys_sigaction(int sig, const struct old_sigaction __user *act,
+ struct old_sigaction __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
struct rt_sigframe
{
- struct siginfo *pinfo;
- void *puc;
+ struct siginfo __user *pinfo;
+ void __user *puc;
struct siginfo info;
struct ucontext uc;
unsigned long retcode;
};
static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
{
int err = 0;
asmlinkage int sys_sigreturn(struct pt_regs *regs)
{
- struct sigframe *frame;
+ struct sigframe __user *frame;
sigset_t set;
/* Always make any pending restarted system calls return -EINTR */
if (regs->ARM_sp & 7)
goto badframe;
- frame = (struct sigframe *)regs->ARM_sp;
+ frame = (struct sigframe __user *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame)))
goto badframe;
asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
{
- struct rt_sigframe *frame;
+ struct rt_sigframe __user *frame;
sigset_t set;
/* Always make any pending restarted system calls return -EINTR */
if (regs->ARM_sp & 7)
goto badframe;
- frame = (struct rt_sigframe *)regs->ARM_sp;
+ frame = (struct rt_sigframe __user *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame)))
goto badframe;
}
static int
-setup_sigcontext(struct sigcontext *sc, /*struct _fpstate *fpstate,*/
+setup_sigcontext(struct sigcontext __user *sc, /*struct _fpstate *fpstate,*/
struct pt_regs *regs, unsigned long mask)
{
int err = 0;
return err;
}
-static inline void *
+static inline void __user *
get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
{
unsigned long sp = regs->ARM_sp;
/*
* ATPCS B01 mandates 8-byte alignment
*/
- return (void *)((sp - framesize) & ~7);
+ return (void __user *)((sp - framesize) & ~7);
}
static int
setup_return(struct pt_regs *regs, struct k_sigaction *ka,
- unsigned long *rc, void *frame, int usig)
+ unsigned long __user *rc, void __user *frame, int usig)
{
unsigned long handler = (unsigned long)ka->sa.sa_handler;
unsigned long retcode;
static int
setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *regs)
{
- struct sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
+ struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
int err = 0;
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs)
{
- struct rt_sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
+ struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
int err = 0;
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
* 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;
unsigned long offset;
};
-asmlinkage int old_mmap(struct mmap_arg_struct *arg)
+asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
{
int error = -EFAULT;
struct mmap_arg_struct a;
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;
*
* 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, ret;
switch (call) {
case SEMOP:
- return sys_semop (first, (struct sembuf *)ptr, second);
+ return sys_semop(first, (struct sembuf __user *)ptr, second);
case SEMGET:
return sys_semget (first, second, third);
case SEMCTL: {
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,
- second, third);
+ return sys_msgsnd(first, (struct msgbuf __user *) ptr,
+ second, third);
case MSGRCV:
switch (version) {
case 0: {
struct ipc_kludge tmp;
if (!ptr)
return -EINVAL;
- if (copy_from_user(&tmp,(struct ipc_kludge *) ptr,
+ if (copy_from_user(&tmp,(struct ipc_kludge __user *)ptr,
sizeof (tmp)))
return -EFAULT;
return sys_msgrcv (first, tmp.msgp, 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 = do_shmat (first, (char *) ptr, second, &raddr);
+ ret = do_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 do_shmat (first, (char *) ptr,
- second, (ulong *) third);
+ return do_shmat(first, (char __user *) ptr,
+ second, (ulong __user *) 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;
}
/* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
-asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_regs *regs)
+asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv,
+ char __user * __user *envp, struct pt_regs *regs)
{
int error;
char * filename;
return len;
}
-static int proc_alignment_write(struct file *file, const char *buffer,
+static int proc_alignment_write(struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
- int mode;
+ char mode;
if (count > 0) {
if (get_user(mode, buffer))
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
-static inline int verify_area(int type, const void * addr, unsigned long size)
+static inline int verify_area(int type, const void __user *addr, unsigned long size)
{
return access_ok(type, addr, size) ? 0 : -EFAULT;
}
: "r" (x), "i" (-EFAULT) \
: "cc")
-extern unsigned long __arch_copy_from_user(void *to, const void *from, unsigned long n);
-extern unsigned long __arch_copy_to_user(void *to, const void *from, unsigned long n);
-extern unsigned long __arch_clear_user(void *addr, unsigned long n);
-extern unsigned long __arch_strncpy_from_user(char *to, const char *from, unsigned long count);
-extern unsigned long __arch_strnlen_user(const char *s, long n);
+extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n);
+extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n);
+extern unsigned long __arch_clear_user(void __user *addr, unsigned long n);
+extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count);
+extern unsigned long __arch_strnlen_user(const char __user *s, long n);
-static __inline__ unsigned long copy_from_user(void *to, const void *from, unsigned long n)
+static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (access_ok(VERIFY_READ, from, n))
n = __arch_copy_from_user(to, from, n);
return n;
}
-static __inline__ unsigned long __copy_from_user(void *to, const void *from, unsigned long n)
+static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
{
return __arch_copy_from_user(to, from, n);
}
-static __inline__ unsigned long copy_to_user(void *to, const void *from, unsigned long n)
+static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
{
if (access_ok(VERIFY_WRITE, to, n))
n = __arch_copy_to_user(to, from, n);
return n;
}
-static __inline__ unsigned long __copy_to_user(void *to, const void *from, unsigned long n)
+static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
{
return __arch_copy_to_user(to, from, n);
}
-static __inline__ unsigned long clear_user (void *to, unsigned long n)
+static inline unsigned long clear_user (void __user *to, unsigned long n)
{
if (access_ok(VERIFY_WRITE, to, n))
n = __arch_clear_user(to, n);
return n;
}
-static __inline__ unsigned long __clear_user (void *to, unsigned long n)
+static inline unsigned long __clear_user (void __user *to, unsigned long n)
{
return __arch_clear_user(to, n);
}
-static __inline__ long strncpy_from_user (char *dst, const char *src, long count)
+static inline long strncpy_from_user (char *dst, const char __user *src, long count)
{
long res = -EFAULT;
if (access_ok(VERIFY_READ, src, 1))
return res;
}
-static __inline__ long __strncpy_from_user (char *dst, const char *src, long count)
+static inline long __strncpy_from_user (char *dst, const char __user *src, long count)
{
return __arch_strncpy_from_user(dst, src, count);
}
#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
-static inline long strnlen_user(const char *s, long n)
+static inline long strnlen_user(const char __user *s, long n)
{
unsigned long res = 0;