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

Merge nuts.ninka.net:/home/davem/src/BK/sparcwork-2.5

into nuts.ninka.net:/home/davem/src/BK/sparc-2.5
parents 898df34c 35ecc0e9
This diff is collapsed.
...@@ -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:
......
This diff is collapsed.
...@@ -473,7 +473,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp) ...@@ -473,7 +473,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
distance = fp - psp; distance = fp - psp;
rval = (csp - distance); rval = (csp - distance);
if (copy_in_user(rval, psp, distance)) if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
rval = 0; rval = 0;
else if (test_thread_flag(TIF_32BIT)) { else if (test_thread_flag(TIF_32BIT)) {
if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6]))) if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6])))
......
...@@ -42,8 +42,8 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -42,8 +42,8 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
/* {set, get}context() needed for 64-bit SparcLinux userland. */ /* {set, get}context() needed for 64-bit SparcLinux userland. */
asmlinkage void sparc64_set_context(struct pt_regs *regs) asmlinkage void sparc64_set_context(struct pt_regs *regs)
{ {
struct ucontext *ucp = (struct ucontext *) regs->u_regs[UREG_I0]; struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
mc_gregset_t *grp; mc_gregset_t __user *grp;
unsigned long pc, npc, tstate; unsigned long pc, npc, tstate;
unsigned long fp, i7; unsigned long fp, i7;
unsigned char fenab; unsigned char fenab;
...@@ -104,9 +104,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs) ...@@ -104,9 +104,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
err |= __get_user(fp, &(ucp->uc_mcontext.mc_fp)); err |= __get_user(fp, &(ucp->uc_mcontext.mc_fp));
err |= __get_user(i7, &(ucp->uc_mcontext.mc_i7)); err |= __get_user(i7, &(ucp->uc_mcontext.mc_i7));
err |= __put_user(fp, err |= __put_user(fp,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6]))); (&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
err |= __put_user(i7, err |= __put_user(i7,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7]))); (&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
err |= __get_user(fenab, &(ucp->uc_mcontext.mc_fpregs.mcfpu_enab)); err |= __get_user(fenab, &(ucp->uc_mcontext.mc_fpregs.mcfpu_enab));
if (fenab) { if (fenab) {
...@@ -121,7 +121,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs) ...@@ -121,7 +121,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
(sizeof(unsigned int) * 32)); (sizeof(unsigned int) * 32));
if (fprs & FPRS_DU) if (fprs & FPRS_DU)
err |= copy_from_user(fpregs+16, err |= copy_from_user(fpregs+16,
((unsigned long *)&(ucp->uc_mcontext.mc_fpregs.mcfpu_fregs))+16, ((unsigned long __user *)&(ucp->uc_mcontext.mc_fpregs.mcfpu_fregs))+16,
(sizeof(unsigned int) * 32)); (sizeof(unsigned int) * 32));
err |= __get_user(current_thread_info()->xfsr[0], err |= __get_user(current_thread_info()->xfsr[0],
&(ucp->uc_mcontext.mc_fpregs.mcfpu_fsr)); &(ucp->uc_mcontext.mc_fpregs.mcfpu_fsr));
...@@ -139,9 +139,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs) ...@@ -139,9 +139,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
asmlinkage void sparc64_get_context(struct pt_regs *regs) asmlinkage void sparc64_get_context(struct pt_regs *regs)
{ {
struct ucontext *ucp = (struct ucontext *) regs->u_regs[UREG_I0]; struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
mc_gregset_t *grp; mc_gregset_t __user *grp;
mcontext_t *mcp; mcontext_t __user *mcp;
unsigned long fp, i7; unsigned long fp, i7;
unsigned char fenab; unsigned char fenab;
int err; int err;
...@@ -170,7 +170,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs) ...@@ -170,7 +170,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
err = 0; err = 0;
if (_NSIG_WORDS == 1) if (_NSIG_WORDS == 1)
err |= __put_user(current->blocked.sig[0], err |= __put_user(current->blocked.sig[0],
(unsigned long *)&ucp->uc_sigmask); (unsigned long __user *)&ucp->uc_sigmask);
else else
err |= __copy_to_user(&ucp->uc_sigmask, &current->blocked, err |= __copy_to_user(&ucp->uc_sigmask, &current->blocked,
sizeof(sigset_t)); sizeof(sigset_t));
...@@ -196,9 +196,9 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs) ...@@ -196,9 +196,9 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
err |= __put_user(regs->u_regs[UREG_I7], &((*grp)[MC_O7])); err |= __put_user(regs->u_regs[UREG_I7], &((*grp)[MC_O7]));
err |= __get_user(fp, err |= __get_user(fp,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6]))); (&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
err |= __get_user(i7, err |= __get_user(i7,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7]))); (&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
err |= __put_user(fp, &(mcp->mc_fp)); err |= __put_user(fp, &(mcp->mc_fp));
err |= __put_user(i7, &(mcp->mc_i7)); err |= __put_user(i7, &(mcp->mc_i7));
...@@ -213,7 +213,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs) ...@@ -213,7 +213,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
(sizeof(unsigned int) * 32)); (sizeof(unsigned int) * 32));
if (fprs & FPRS_DU) if (fprs & FPRS_DU)
err |= copy_to_user( err |= copy_to_user(
((unsigned long *)&(mcp->mc_fpregs.mcfpu_fregs))+16, fpregs+16, ((unsigned long __user *)&(mcp->mc_fpregs.mcfpu_fregs))+16, fpregs+16,
(sizeof(unsigned int) * 32)); (sizeof(unsigned int) * 32));
err |= __put_user(current_thread_info()->xfsr[0], &(mcp->mc_fpregs.mcfpu_fsr)); err |= __put_user(current_thread_info()->xfsr[0], &(mcp->mc_fpregs.mcfpu_fsr));
err |= __put_user(current_thread_info()->gsr[0], &(mcp->mc_fpregs.mcfpu_gsr)); err |= __put_user(current_thread_info()->gsr[0], &(mcp->mc_fpregs.mcfpu_gsr));
...@@ -231,7 +231,7 @@ struct rt_signal_frame { ...@@ -231,7 +231,7 @@ struct rt_signal_frame {
struct sparc_stackf ss; struct sparc_stackf ss;
siginfo_t info; siginfo_t info;
struct pt_regs regs; struct pt_regs regs;
__siginfo_fpu_t * fpu_save; __siginfo_fpu_t __user *fpu_save;
stack_t stack; stack_t stack;
sigset_t mask; sigset_t mask;
__siginfo_fpu_t fpu_state; __siginfo_fpu_t fpu_state;
...@@ -300,7 +300,7 @@ asmlinkage void do_sigsuspend(struct pt_regs *regs) ...@@ -300,7 +300,7 @@ asmlinkage void do_sigsuspend(struct pt_regs *regs)
_sigpause_common(regs->u_regs[UREG_I0], regs); _sigpause_common(regs->u_regs[UREG_I0], regs);
} }
asmlinkage void do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, struct pt_regs *regs) asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, struct pt_regs *regs)
{ {
sigset_t oldset, set; sigset_t oldset, set;
...@@ -351,7 +351,7 @@ asmlinkage void do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, struct pt_re ...@@ -351,7 +351,7 @@ asmlinkage void do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, struct pt_re
} }
static inline int static inline int
restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu) restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
{ {
unsigned long *fpregs = current_thread_info()->fpregs; unsigned long *fpregs = current_thread_info()->fpregs;
unsigned long fprs; unsigned long fprs;
...@@ -374,16 +374,16 @@ restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu) ...@@ -374,16 +374,16 @@ restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
void do_rt_sigreturn(struct pt_regs *regs) void do_rt_sigreturn(struct pt_regs *regs)
{ {
struct rt_signal_frame *sf; struct rt_signal_frame __user *sf;
unsigned long tpc, tnpc, tstate; unsigned long tpc, tnpc, tstate;
__siginfo_fpu_t *fpu_save; __siginfo_fpu_t __user *fpu_save;
mm_segment_t old_fs; mm_segment_t old_fs;
sigset_t set; sigset_t set;
stack_t st; stack_t st;
int err; int err;
synchronize_user_stack (); synchronize_user_stack ();
sf = (struct rt_signal_frame *) sf = (struct rt_signal_frame __user *)
(regs->u_regs [UREG_FP] + STACK_BIAS); (regs->u_regs [UREG_FP] + STACK_BIAS);
/* 1. Make sure we are not getting garbage from the user */ /* 1. Make sure we are not getting garbage from the user */
...@@ -438,7 +438,7 @@ void do_rt_sigreturn(struct pt_regs *regs) ...@@ -438,7 +438,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
} }
/* Checks if the fp is valid */ /* Checks if the fp is valid */
static int invalid_frame_pointer(void *fp, int fplen) static int invalid_frame_pointer(void __user *fp, int fplen)
{ {
if (((unsigned long) fp) & 7) if (((unsigned long) fp) & 7)
return 1; return 1;
...@@ -446,7 +446,7 @@ static int invalid_frame_pointer(void *fp, int fplen) ...@@ -446,7 +446,7 @@ static int invalid_frame_pointer(void *fp, int fplen)
} }
static inline int static inline int
save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu) save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
{ {
unsigned long *fpregs = (unsigned long *)(regs+1); unsigned long *fpregs = (unsigned long *)(regs+1);
unsigned long fprs; unsigned long fprs;
...@@ -466,7 +466,7 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu) ...@@ -466,7 +466,7 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
return err; return err;
} }
static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize) static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize)
{ {
unsigned long sp; unsigned long sp;
...@@ -478,14 +478,14 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, u ...@@ -478,14 +478,14 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, u
!((current->sas_ss_sp + current->sas_ss_size) & 7)) !((current->sas_ss_sp + current->sas_ss_size) & 7))
sp = current->sas_ss_sp + current->sas_ss_size; sp = current->sas_ss_sp + current->sas_ss_size;
} }
return (void *)(sp - framesize); return (void __user *)(sp - framesize);
} }
static inline void static inline void
setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
int signo, sigset_t *oldset, siginfo_t *info) int signo, sigset_t *oldset, siginfo_t *info)
{ {
struct rt_signal_frame *sf; struct rt_signal_frame __user *sf;
int sigframe_size, err; int sigframe_size, err;
/* 1. Make sure everything is clean */ /* 1. Make sure everything is clean */
...@@ -496,7 +496,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -496,7 +496,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
if (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) if (!(current_thread_info()->fpsaved[0] & FPRS_FEF))
sigframe_size -= sizeof(__siginfo_fpu_t); sigframe_size -= sizeof(__siginfo_fpu_t);
sf = (struct rt_signal_frame *)get_sigframe(ka, regs, sigframe_size); sf = (struct rt_signal_frame __user *)
get_sigframe(ka, regs, sigframe_size);
if (invalid_frame_pointer (sf, sigframe_size)) if (invalid_frame_pointer (sf, sigframe_size))
goto sigill; goto sigill;
...@@ -521,8 +522,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -521,8 +522,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t)); err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t));
err |= copy_in_user((u64 *)sf, err |= copy_in_user((u64 __user *)sf,
(u64 *)(regs->u_regs[UREG_FP]+STACK_BIAS), (u64 __user *)(regs->u_regs[UREG_FP]+STACK_BIAS),
sizeof(struct reg_window)); sizeof(struct reg_window));
if (info) if (info)
...@@ -560,7 +561,8 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, ...@@ -560,7 +561,8 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka,
siginfo_t *info, siginfo_t *info,
sigset_t *oldset, struct pt_regs *regs) sigset_t *oldset, struct pt_regs *regs)
{ {
setup_rt_frame(ka, regs, signr, oldset, (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); setup_rt_frame(ka, regs, signr, oldset,
(ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
if (ka->sa.sa_flags & SA_ONESHOT) if (ka->sa.sa_flags & SA_ONESHOT)
ka->sa.sa_handler = SIG_DFL; ka->sa.sa_handler = SIG_DFL;
if (!(ka->sa.sa_flags & SA_NOMASK)) { if (!(ka->sa.sa_flags & SA_NOMASK)) {
......
This diff is collapsed.
...@@ -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) {
......
...@@ -118,10 +118,10 @@ struct sigstack { ...@@ -118,10 +118,10 @@ struct sigstack {
}; };
/* Sigvec flags */ /* Sigvec flags */
#define SV_SSTACK 1 /* This signal handler should use sig-stack */ #define SV_SSTACK 1u /* This signal handler should use sig-stack */
#define SV_INTR 2 /* Sig return should not restart system call */ #define SV_INTR 2u /* Sig return should not restart system call */
#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */ #define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8 /* Do not send SIGCHLD */ #define SV_IGNCHILD 8u /* Do not send SIGCHLD */
/* /*
* sa_flags values: SA_STACK is not currently supported, but will allow the * sa_flags values: SA_STACK is not currently supported, but will allow the
...@@ -137,11 +137,11 @@ struct sigstack { ...@@ -137,11 +137,11 @@ struct sigstack {
#define SA_ONSTACK SV_SSTACK #define SA_ONSTACK SV_SSTACK
#define SA_RESTART SV_INTR #define SA_RESTART SV_INTR
#define SA_ONESHOT SV_RESET #define SA_ONESHOT SV_RESET
#define SA_INTERRUPT 0x10 #define SA_INTERRUPT 0x10u
#define SA_NOMASK 0x20 #define SA_NOMASK 0x20u
#define SA_SHIRQ 0x40 #define SA_SHIRQ 0x40u
#define SA_NOCLDWAIT 0x100 #define SA_NOCLDWAIT 0x100u
#define SA_SIGINFO 0x200 #define SA_SIGINFO 0x200u
#define SIG_BLOCK 0x01 /* for blocking signals */ #define SIG_BLOCK 0x01 /* for blocking signals */
#define SIG_UNBLOCK 0x02 /* for unblocking signals */ #define SIG_UNBLOCK 0x02 /* for unblocking signals */
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define _ASM_UACCESS_H #define _ASM_UACCESS_H
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
#define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size)))
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
extern 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; return access_ok(type,addr,size)?0:-EFAULT;
} }
...@@ -291,87 +292,87 @@ __asm__ __volatile__( \ ...@@ -291,87 +292,87 @@ __asm__ __volatile__( \
extern int __get_user_bad(void); extern int __get_user_bad(void);
extern __kernel_size_t __copy_user(void *to, void *from, __kernel_size_t size); extern unsigned long __copy_user(void *to, void *from, unsigned long size);
#define copy_to_user(to,from,n) ({ \ static inline unsigned long copy_to_user(void __user *to, void *from, unsigned long n)
void *__copy_to = (void *) (to); \
__kernel_size_t __copy_size = (__kernel_size_t) (n); \
__kernel_size_t __copy_res; \
if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \
__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
} else __copy_res = __copy_size; \
__copy_res; })
#define __copy_to_user(to,from,n) \
__copy_user((void *)(to), \
(void *)(from), n)
#define copy_from_user(to,from,n) ({ \
void *__copy_to = (void *) (to); \
void *__copy_from = (void *) (from); \
__kernel_size_t __copy_size = (__kernel_size_t) (n); \
__kernel_size_t __copy_res; \
if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \
__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
} else __copy_res = __copy_size; \
__copy_res; })
#define __copy_from_user(to,from,n) \
__copy_user((void *)(to), \
(void *)(from), n)
extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size)
{ {
__kernel_size_t ret; if (n && __access_ok((unsigned long) to, n))
__asm__ __volatile__ ( return __copy_user((void *) to, from, n);
".section __ex_table,#alloc\n\t" else
".align 4\n\t" return n;
".word 1f,3\n\t"
".previous\n\t"
"mov %2, %%o1\n"
"1:\n\t"
"call __bzero\n\t"
" mov %1, %%o0\n\t"
"mov %%o0, %0\n"
: "=r" (ret) : "r" (addr), "r" (size) :
"o0", "o1", "o2", "o3", "o4", "o5", "o7",
"g1", "g2", "g3", "g4", "g5", "g7", "cc");
return ret;
} }
#define clear_user(addr,n) ({ \ static inline unsigned long __copy_to_user(void __user *to, void *from, unsigned long n)
void *__clear_addr = (void *) (addr); \ {
__kernel_size_t __clear_size = (__kernel_size_t) (n); \ return __copy_user((void *)to, from, n);
__kernel_size_t __clear_res; \ }
if(__clear_size && __access_ok((unsigned long)__clear_addr, __clear_size)) { \
__clear_res = __clear_user(__clear_addr, __clear_size); \ static inline unsigned long copy_from_user(void *to, void __user *from, unsigned long n)
} else __clear_res = __clear_size; \ {
__clear_res; }) if (n && __access_ok((unsigned long) from, n))
return __copy_user(to, (void *) from, n);
extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count); else
return n;
#define strncpy_from_user(dest,src,count) ({ \ }
unsigned long __sfu_src = (unsigned long) (src); \
int __sfu_count = (int) (count); \ static inline unsigned long __copy_from_user(void *to, void __user *from, unsigned long n)
long __sfu_res = -EFAULT; \ {
if(__access_ok(__sfu_src, __sfu_count)) { \ return __copy_user(to, (void *)from, n);
__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \ }
} __sfu_res; })
static inline unsigned long __clear_user(void __user *addr, unsigned long size)
extern int __strlen_user(const char *); {
extern int __strnlen_user(const char *, long len); unsigned long ret;
extern __inline__ int strlen_user(const char *str) __asm__ __volatile__ (
".section __ex_table,#alloc\n\t"
".align 4\n\t"
".word 1f,3\n\t"
".previous\n\t"
"mov %2, %%o1\n"
"1:\n\t"
"call __bzero\n\t"
" mov %1, %%o0\n\t"
"mov %%o0, %0\n"
: "=r" (ret) : "r" (addr), "r" (size) :
"o0", "o1", "o2", "o3", "o4", "o5", "o7",
"g1", "g2", "g3", "g4", "g5", "g7", "cc");
return ret;
}
static inline unsigned long clear_user(void __user *addr, unsigned long n)
{
if (n && __access_ok((unsigned long) addr, n)) {
return __clear_user(addr, n);
else
return n;
}
extern long __strncpy_from_user(char *dest, const char __user *src, long count);
static inline long strncpy_from_user(char *dest, const char __user *src, long count)
{
if (__access_ok((unsigned long) src, count))
return __strncpy_from_user(dest, src, count);
else
return -EFAULT;
}
extern long __strlen_user(const char __user *);
extern long __strnlen_user(const char __user *, long len);
static inline long strlen_user(const char __user *str)
{ {
if(!access_ok(VERIFY_READ, str, 0)) if (!access_ok(VERIFY_READ, str, 0))
return 0; return 0;
else else
return __strlen_user(str); return __strlen_user(str);
} }
extern __inline__ int strnlen_user(const char *str, long len) static inline long strnlen_user(const char __user *str, long len)
{ {
if(!access_ok(VERIFY_READ, str, 0)) if (!access_ok(VERIFY_READ, str, 0))
return 0; return 0;
else else
return __strnlen_user(str, len); return __strnlen_user(str, len);
......
...@@ -123,10 +123,10 @@ struct sigstack { ...@@ -123,10 +123,10 @@ struct sigstack {
}; };
/* Sigvec flags */ /* Sigvec flags */
#define SV_SSTACK 1 /* This signal handler should use sig-stack */ #define SV_SSTACK 1u /* This signal handler should use sig-stack */
#define SV_INTR 2 /* Sig return should not restart system call */ #define SV_INTR 2u /* Sig return should not restart system call */
#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */ #define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8 /* Do not send SIGCHLD */ #define SV_IGNCHILD 8u /* Do not send SIGCHLD */
/* /*
* sa_flags values: SA_STACK is not currently supported, but will allow the * sa_flags values: SA_STACK is not currently supported, but will allow the
...@@ -142,11 +142,11 @@ struct sigstack { ...@@ -142,11 +142,11 @@ struct sigstack {
#define SA_ONSTACK SV_SSTACK #define SA_ONSTACK SV_SSTACK
#define SA_RESTART SV_INTR #define SA_RESTART SV_INTR
#define SA_ONESHOT SV_RESET #define SA_ONESHOT SV_RESET
#define SA_INTERRUPT 0x10 #define SA_INTERRUPT 0x10u
#define SA_NOMASK 0x20 #define SA_NOMASK 0x20u
#define SA_SHIRQ 0x40 #define SA_SHIRQ 0x40u
#define SA_NOCLDWAIT 0x100 #define SA_NOCLDWAIT 0x100u
#define SA_SIGINFO 0x200 #define SA_SIGINFO 0x200u
#define SIG_BLOCK 0x01 /* for blocking signals */ #define SIG_BLOCK 0x01 /* for blocking signals */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/string.h> #include <linux/string.h>
#include <asm/a.out.h> #include <asm/a.out.h>
...@@ -52,7 +53,7 @@ do { \ ...@@ -52,7 +53,7 @@ do { \
#define __access_ok(addr,size) 1 #define __access_ok(addr,size) 1
#define access_ok(type,addr,size) 1 #define access_ok(type,addr,size) 1
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 0; return 0;
} }
...@@ -249,44 +250,34 @@ __asm__ __volatile__( \ ...@@ -249,44 +250,34 @@ __asm__ __volatile__( \
extern int __get_user_bad(void); extern int __get_user_bad(void);
extern __kernel_size_t __copy_from_user(void *to, const void *from, extern unsigned long __copy_from_user(void *to, const void __user *from,
__kernel_size_t size); unsigned long size);
extern __kernel_size_t __copy_to_user(void *to, const void *from, extern unsigned long __copy_to_user(void __user *to, const void *from,
__kernel_size_t size); unsigned long size);
extern __kernel_size_t __copy_in_user(void *to, const void *from, extern unsigned long __copy_in_user(void __user *to, const void __user *from,
__kernel_size_t size); unsigned long size);
#define copy_from_user(to,from,n) \ #define copy_from_user __copy_from_user
__copy_from_user((void *)(to), \ #define copy_to_user __copy_to_user
(void *)(from), (__kernel_size_t)(n)) #define copy_in_user __copy_in_user
#define copy_to_user(to,from,n) \ static inline unsigned long __clear_user(void __user *addr, unsigned long size)
__copy_to_user((void *)(to), \
(void *) (from), (__kernel_size_t)(n))
#define copy_in_user(to,from,n) \
__copy_in_user((void *)(to), \
(void *) (from), (__kernel_size_t)(n))
static __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size)
{ {
extern __kernel_size_t __bzero_noasi(void *addr, __kernel_size_t size); extern unsigned long __bzero_noasi(void *addr, unsigned long size);
return __bzero_noasi(addr, size); return __bzero_noasi((void *) addr, size);
} }
#define clear_user(addr,n) \ #define clear_user __clear_user
__clear_user((void *)(addr), (__kernel_size_t)(n))
extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count); extern long __strncpy_from_user(char *dest, const char __user *src, long count);
#define strncpy_from_user(dest,src,count) \ #define strncpy_from_user __strncpy_from_user
__strncpy_from_user((unsigned long)(dest), (unsigned long)(src), (int)(count))
extern int __strlen_user(const char *); extern long __strlen_user(const char __user *);
extern int __strnlen_user(const char *, long len); extern long __strnlen_user(const char __user *, long len);
#define strlen_user __strlen_user #define strlen_user __strlen_user
#define strnlen_user __strnlen_user #define strnlen_user __strnlen_user
......
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