Commit 52e86726 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] solaris emulation annotated

trivial annotations and cleanups + proper use of vfs_...stat().
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent def699d3
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
__asm__ ("srl %0, 0, %0" \ __asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \ : "=r" (__ret) \
: "0" (__x)); \ : "0" (__x)); \
__ret; \ (void __user *)__ret; \
}) })
extern unsigned sys_call_table[]; extern unsigned sys_call_table[];
......
This diff is collapsed.
This diff is collapsed.
...@@ -54,8 +54,8 @@ struct solaris_shmid_ds { ...@@ -54,8 +54,8 @@ struct solaris_shmid_ds {
asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
{ {
int (*sys_ipc)(unsigned,int,int,unsigned long,void *,long) = int (*sys_ipc)(unsigned,int,int,unsigned long,void __user *,long) =
(int (*)(unsigned,int,int,unsigned long,void *,long))SYS(ipc); (int (*)(unsigned,int,int,unsigned long,void __user *,long))SYS(ipc);
mm_segment_t old_fs; mm_segment_t old_fs;
unsigned long raddr; unsigned long raddr;
int ret; int ret;
...@@ -64,7 +64,7 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -64,7 +64,7 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 0: /* shmat */ case 0: /* shmat */
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ipc(SHMAT, arg1, arg3 & ~0x4000, (unsigned long)&raddr, (void *)A(arg2), 0); ret = sys_ipc(SHMAT, arg1, arg3 & ~0x4000, (unsigned long)&raddr, A(arg2), 0);
set_fs(old_fs); set_fs(old_fs);
if (ret >= 0) return (u32)raddr; if (ret >= 0) return (u32)raddr;
else return ret; else return ret;
...@@ -78,10 +78,11 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -78,10 +78,11 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 11: /* IPC_SET */ case 11: /* IPC_SET */
{ {
struct shmid_ds s; struct shmid_ds s;
struct solaris_shmid_ds __user *p = A(arg3);
if (get_user (s.shm_perm.uid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.uid)) || if (get_user (s.shm_perm.uid, &p->shm_perm.uid) ||
__get_user (s.shm_perm.gid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.gid)) || __get_user (s.shm_perm.gid, &p->shm_perm.gid) ||
__get_user (s.shm_perm.mode, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.mode))) __get_user (s.shm_perm.mode, &p->shm_perm.mode))
return -EFAULT; return -EFAULT;
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -92,32 +93,33 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -92,32 +93,33 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 12: /* IPC_STAT */ case 12: /* IPC_STAT */
{ {
struct shmid_ds s; struct shmid_ds s;
struct solaris_shmid_ds __user *p = A(arg3);
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0); ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0);
set_fs(old_fs); set_fs(old_fs);
if (get_user (s.shm_perm.uid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.uid)) || if (put_user (s.shm_perm.uid, &(p->shm_perm.uid)) ||
__get_user (s.shm_perm.gid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.gid)) || __put_user (s.shm_perm.gid, &(p->shm_perm.gid)) ||
__get_user (s.shm_perm.cuid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.cuid)) || __put_user (s.shm_perm.cuid, &(p->shm_perm.cuid)) ||
__get_user (s.shm_perm.cgid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.cgid)) || __put_user (s.shm_perm.cgid, &(p->shm_perm.cgid)) ||
__get_user (s.shm_perm.mode, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.mode)) || __put_user (s.shm_perm.mode, &(p->shm_perm.mode)) ||
__get_user (s.shm_perm.seq, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.seq)) || __put_user (s.shm_perm.seq, &(p->shm_perm.seq)) ||
__get_user (s.shm_perm.key, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.key)) || __put_user (s.shm_perm.key, &(p->shm_perm.key)) ||
__get_user (s.shm_segsz, &(((struct solaris_shmid_ds *)A(arg3))->shm_segsz)) || __put_user (s.shm_segsz, &(p->shm_segsz)) ||
__get_user (s.shm_lpid, &(((struct solaris_shmid_ds *)A(arg3))->shm_lpid)) || __put_user (s.shm_lpid, &(p->shm_lpid)) ||
__get_user (s.shm_cpid, &(((struct solaris_shmid_ds *)A(arg3))->shm_cpid)) || __put_user (s.shm_cpid, &(p->shm_cpid)) ||
__get_user (s.shm_nattch, &(((struct solaris_shmid_ds *)A(arg3))->shm_nattch)) || __put_user (s.shm_nattch, &(p->shm_nattch)) ||
__get_user (s.shm_atime, &(((struct solaris_shmid_ds *)A(arg3))->shm_atime)) || __put_user (s.shm_atime, &(p->shm_atime)) ||
__get_user (s.shm_dtime, &(((struct solaris_shmid_ds *)A(arg3))->shm_dtime)) || __put_user (s.shm_dtime, &(p->shm_dtime)) ||
__get_user (s.shm_ctime, &(((struct solaris_shmid_ds *)A(arg3))->shm_ctime))) __put_user (s.shm_ctime, &(p->shm_ctime)))
return -EFAULT; return -EFAULT;
return ret; return ret;
} }
default: return -EINVAL; default: return -EINVAL;
} }
case 2: /* shmdt */ case 2: /* shmdt */
return sys_ipc(SHMDT, 0, 0, 0, (void *)A(arg1), 0); return sys_ipc(SHMDT, 0, 0, 0, A(arg1), 0);
case 3: /* shmget */ case 3: /* shmget */
return sys_ipc(SHMGET, arg1, arg2, arg3, NULL, 0); return sys_ipc(SHMGET, arg1, arg2, arg3, NULL, 0);
} }
......
...@@ -121,10 +121,10 @@ asmlinkage u32 solaris_mmap64(struct pt_regs *regs, u32 len, u32 prot, u32 flags ...@@ -121,10 +121,10 @@ asmlinkage u32 solaris_mmap64(struct pt_regs *regs, u32 len, u32 prot, u32 flags
u32 offlo; u32 offlo;
if (regs->u_regs[UREG_G1]) { if (regs->u_regs[UREG_G1]) {
if (get_user (offlo, (u32 *)(long)((u32)regs->u_regs[UREG_I6] + 0x5c))) if (get_user (offlo, (u32 __user *)(long)((u32)regs->u_regs[UREG_I6] + 0x5c)))
return -EFAULT; return -EFAULT;
} else { } else {
if (get_user (offlo, (u32 *)(long)((u32)regs->u_regs[UREG_I6] + 0x60))) if (get_user (offlo, (u32 __user *)(long)((u32)regs->u_regs[UREG_I6] + 0x60)))
return -EFAULT; return -EFAULT;
} }
return do_solaris_mmap((u32)regs->u_regs[UREG_I0], len, prot, flags, fd, (((u64)offhi)<<32)|offlo); return do_solaris_mmap((u32)regs->u_regs[UREG_I0], len, prot, flags, fd, (((u64)offhi)<<32)|offlo);
...@@ -148,7 +148,7 @@ asmlinkage int solaris_brk(u32 brk) ...@@ -148,7 +148,7 @@ asmlinkage int solaris_brk(u32 brk)
for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \ for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \
else \ else \
i = len - 1; \ i = len - 1; \
if (__put_user('\0', (char *)(to+i))) \ if (__put_user('\0', (char __user *)((to)+i))) \
return -EFAULT; \ return -EFAULT; \
} }
...@@ -218,21 +218,17 @@ static char *serial(char *buffer) ...@@ -218,21 +218,17 @@ static char *serial(char *buffer)
asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2) asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
{ {
struct sol_uname __user *v = A(buf);
switch (which) { switch (which) {
case 0: /* old uname */ case 0: /* old uname */
/* Let's cheat */ /* Let's cheat */
set_utsfield(((struct sol_uname *)A(buf))->sysname, set_utsfield(v->sysname, "SunOS", 1, 0);
"SunOS", 1, 0);
down_read(&uts_sem); down_read(&uts_sem);
set_utsfield(((struct sol_uname *)A(buf))->nodename, set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
system_utsname.nodename, 1, 1);
up_read(&uts_sem); up_read(&uts_sem);
set_utsfield(((struct sol_uname *)A(buf))->release, set_utsfield(v->release, "2.6", 0, 0);
"2.6", 0, 0); set_utsfield(v->version, "Generic", 0, 0);
set_utsfield(((struct sol_uname *)A(buf))->version, set_utsfield(v->machine, machine(), 0, 0);
"Generic", 0, 0);
set_utsfield(((struct sol_uname *)A(buf))->machine,
machine(), 0, 0);
return 0; return 0;
case 2: /* ustat */ case 2: /* ustat */
return -ENOSYS; return -ENOSYS;
...@@ -245,18 +241,14 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2) ...@@ -245,18 +241,14 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
asmlinkage int solaris_utsname(u32 buf) asmlinkage int solaris_utsname(u32 buf)
{ {
struct sol_utsname __user *v = A(buf);
/* Why should we not lie a bit? */ /* Why should we not lie a bit? */
down_read(&uts_sem); down_read(&uts_sem);
set_utsfield(((struct sol_utsname *)A(buf))->sysname, set_utsfield(v->sysname, "SunOS", 0, 0);
"SunOS", 0, 0); set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
set_utsfield(((struct sol_utsname *)A(buf))->nodename, set_utsfield(v->release, "5.6", 0, 0);
system_utsname.nodename, 1, 1); set_utsfield(v->version, "Generic", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->release, set_utsfield(v->machine, machine(), 0, 0);
"5.6", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->version,
"Generic", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->machine,
machine(), 0, 0);
up_read(&uts_sem); up_read(&uts_sem);
return 0; return 0;
} }
...@@ -302,11 +294,11 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count) ...@@ -302,11 +294,11 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
} }
len = strlen(r) + 1; len = strlen(r) + 1;
if (count < len) { if (count < len) {
if (copy_to_user((char *)A(buf), r, count - 1) || if (copy_to_user(A(buf), r, count - 1) ||
__put_user(0, (char *)A(buf) + count - 1)) __put_user(0, (char __user *)A(buf) + count - 1))
return -EFAULT; return -EFAULT;
} else { } else {
if (copy_to_user((char *)A(buf), r, len)) if (copy_to_user(A(buf), r, len))
return -EFAULT; return -EFAULT;
} }
return len; return len;
...@@ -453,7 +445,7 @@ struct rlimit32 { ...@@ -453,7 +445,7 @@ struct rlimit32 {
u32 rlim_max; u32 rlim_max;
}; };
asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim) asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 __user *rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
...@@ -486,15 +478,15 @@ asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim) ...@@ -486,15 +478,15 @@ asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim)
return ret; return ret;
} }
asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim) asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 __user *rlim)
{ {
struct rlimit r, rold; struct rlimit r, rold;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
int (*sys_setrlimit)(unsigned int, struct rlimit *) = int (*sys_setrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(setrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(setrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -527,13 +519,13 @@ asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim) ...@@ -527,13 +519,13 @@ asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim)
return ret; return ret;
} }
asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim) asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -556,15 +548,15 @@ asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim) ...@@ -556,15 +548,15 @@ asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim)
return ret; return ret;
} }
asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit *rlim) asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit r, rold; struct rlimit r, rold;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
int (*sys_setrlimit)(unsigned int, struct rlimit *) = int (*sys_setrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(setrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(setrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -623,10 +615,10 @@ struct sol_timex { ...@@ -623,10 +615,10 @@ struct sol_timex {
s32 stbcnt; s32 stbcnt;
}; };
asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp) asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval __user *ntp)
{ {
int (*sys_adjtimex)(struct timex *) = int (*sys_adjtimex)(struct timex __user *) =
(int (*)(struct timex *))SYS(adjtimex); (int (*)(struct timex __user *))SYS(adjtimex);
struct timex t; struct timex t;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
...@@ -644,10 +636,10 @@ asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp) ...@@ -644,10 +636,10 @@ asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp)
return ret; return ret;
} }
asmlinkage int solaris_ntp_adjtime(struct sol_timex *txp) asmlinkage int solaris_ntp_adjtime(struct sol_timex __user *txp)
{ {
int (*sys_adjtimex)(struct timex *) = int (*sys_adjtimex)(struct timex __user *) =
(int (*)(struct timex *))SYS(adjtimex); (int (*)(struct timex __user *))SYS(adjtimex);
struct timex t; struct timex t;
int ret, err; int ret, err;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
......
...@@ -76,8 +76,8 @@ static long sig_handler(int sig, u32 arg, int one_shot) ...@@ -76,8 +76,8 @@ static long sig_handler(int sig, u32 arg, int one_shot)
struct sigaction sa, old; struct sigaction sa, old;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_sigaction)(int,struct sigaction *,struct sigaction *) = int (*sys_sigaction)(int,struct sigaction __user *,struct sigaction __user *) =
(int (*)(int,struct sigaction *,struct sigaction *))SYS(sigaction); (int (*)(int,struct sigaction __user *,struct sigaction __user *))SYS(sigaction);
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_restorer = NULL; sa.sa_restorer = NULL;
...@@ -85,10 +85,10 @@ static long sig_handler(int sig, u32 arg, int one_shot) ...@@ -85,10 +85,10 @@ static long sig_handler(int sig, u32 arg, int one_shot)
sa.sa_flags = 0; sa.sa_flags = 0;
if (one_shot) sa.sa_flags = SA_ONESHOT | SA_NOMASK; if (one_shot) sa.sa_flags = SA_ONESHOT | SA_NOMASK;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sigaction(sig, &sa, &old); ret = sys_sigaction(sig, (void __user *)&sa, (void __user *)&old);
set_fs (old_fs); set_fs (old_fs);
if (ret < 0) return ret; if (ret < 0) return ret;
return (u32)(long)old.sa_handler; return (u32)(unsigned long)old.sa_handler;
} }
static inline long solaris_signal(int sig, u32 arg) static inline long solaris_signal(int sig, u32 arg)
...@@ -129,7 +129,7 @@ static inline long solaris_sigrelse(int sig) ...@@ -129,7 +129,7 @@ static inline long solaris_sigrelse(int sig)
static inline long solaris_sigignore(int sig) static inline long solaris_sigignore(int sig)
{ {
return sig_handler (sig, (u32)SIG_IGN, 0); return sig_handler(sig, (u32)(unsigned long)SIG_IGN, 0);
} }
static inline long solaris_sigpause(int sig) static inline long solaris_sigpause(int sig)
...@@ -207,21 +207,22 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out) ...@@ -207,21 +207,22 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out)
sigset_t in_s, *ins, out_s, *outs; sigset_t in_s, *ins, out_s, *outs;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
int (*sys_sigprocmask)(int,sigset_t *,sigset_t *) = int (*sys_sigprocmask)(int,sigset_t __user *,sigset_t __user *) =
(int (*)(int,sigset_t *,sigset_t *))SYS(sigprocmask); (int (*)(int,sigset_t __user *,sigset_t __user *))SYS(sigprocmask);
ins = NULL; outs = NULL; ins = NULL; outs = NULL;
if (in) { if (in) {
u32 tmp[2]; u32 tmp[2];
if (copy_from_user (tmp, (sol_sigset_t *)A(in), 2*sizeof(u32))) if (copy_from_user (tmp, (void __user *)A(in), 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
ins = &in_s; ins = &in_s;
if (mapin (tmp, ins)) return -EINVAL; if (mapin (tmp, ins)) return -EINVAL;
} }
if (out) outs = &out_s; if (out) outs = &out_s;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sigprocmask((how == 3) ? SIG_SETMASK : how, ins, outs); ret = sys_sigprocmask((how == 3) ? SIG_SETMASK : how,
(void __user *)ins, (void __user *)outs);
set_fs (old_fs); set_fs (old_fs);
if (ret) return ret; if (ret) return ret;
if (out) { if (out) {
...@@ -229,7 +230,7 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out) ...@@ -229,7 +230,7 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out)
tmp[2] = 0; tmp[3] = 0; tmp[2] = 0; tmp[3] = 0;
if (mapout (outs, tmp)) return -EINVAL; if (mapout (outs, tmp)) return -EINVAL;
if (copy_to_user((sol_sigset_t *)A(out), tmp, 4*sizeof(u32))) if (copy_to_user((void __user *)A(out), tmp, 4*sizeof(u32)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -240,7 +241,7 @@ asmlinkage long do_sol_sigsuspend(u32 mask) ...@@ -240,7 +241,7 @@ asmlinkage long do_sol_sigsuspend(u32 mask)
sigset_t s; sigset_t s;
u32 tmp[2]; u32 tmp[2];
if (copy_from_user (tmp, (sol_sigset_t *)A(mask), 2*sizeof(u32))) if (copy_from_user (tmp, (sol_sigset_t __user *)A(mask), 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
if (mapin (tmp, &s)) return -EINVAL; if (mapin (tmp, &s)) return -EINVAL;
return (long)s.sig[0]; return (long)s.sig[0];
...@@ -259,18 +260,19 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -259,18 +260,19 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
struct sigaction s, s2; struct sigaction s, s2;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_sigaction)(int,struct sigaction *,struct sigaction *) = struct sol_sigaction __user *p = (void __user *)A(old);
(int (*)(int,struct sigaction *,struct sigaction *))SYS(sigaction); int (*sys_sigaction)(int,struct sigaction __user *,struct sigaction __user *) =
(int (*)(int,struct sigaction __user *,struct sigaction __user *))SYS(sigaction);
sig = mapsig(sig); sig = mapsig(sig);
if (sig < 0) { if (sig < 0) {
/* We cheat a little bit for Solaris only signals */ /* We cheat a little bit for Solaris only signals */
if (old && clear_user((struct sol_sigaction *)A(old), sizeof(struct sol_sigaction))) if (old && clear_user(p, sizeof(struct sol_sigaction)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
if (act) { if (act) {
if (get_user (tmp, &((struct sol_sigaction *)A(act))->sa_flags)) if (get_user (tmp, &p->sa_flags))
return -EFAULT; return -EFAULT;
s.sa_flags = 0; s.sa_flags = 0;
if (tmp & SOLARIS_SA_ONSTACK) s.sa_flags |= SA_STACK; if (tmp & SOLARIS_SA_ONSTACK) s.sa_flags |= SA_STACK;
...@@ -278,15 +280,16 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -278,15 +280,16 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
if (tmp & SOLARIS_SA_NODEFER) s.sa_flags |= SA_NOMASK; if (tmp & SOLARIS_SA_NODEFER) s.sa_flags |= SA_NOMASK;
if (tmp & SOLARIS_SA_RESETHAND) s.sa_flags |= SA_ONESHOT; if (tmp & SOLARIS_SA_RESETHAND) s.sa_flags |= SA_ONESHOT;
if (tmp & SOLARIS_SA_NOCLDSTOP) s.sa_flags |= SA_NOCLDSTOP; if (tmp & SOLARIS_SA_NOCLDSTOP) s.sa_flags |= SA_NOCLDSTOP;
if (get_user (tmp, &((struct sol_sigaction *)A(act))->sa_handler) || if (get_user (tmp, &p->sa_handler) ||
copy_from_user (tmp2, &((struct sol_sigaction *)A(act))->sa_mask, 2*sizeof(u32))) copy_from_user (tmp2, &p->sa_mask, 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
s.sa_handler = (__sighandler_t)A(tmp); s.sa_handler = (__sighandler_t)A(tmp);
if (mapin (tmp2, &s.sa_mask)) return -EINVAL; if (mapin (tmp2, &s.sa_mask)) return -EINVAL;
s.sa_restorer = 0; s.sa_restorer = NULL;
} }
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sigaction(sig, act ? &s : NULL, old ? &s2 : NULL); ret = sys_sigaction(sig, act ? (void __user *)&s : NULL,
old ? (void __user *)&s2 : NULL);
set_fs(old_fs); set_fs(old_fs);
if (ret) return ret; if (ret) return ret;
if (old) { if (old) {
...@@ -297,9 +300,9 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -297,9 +300,9 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
if (s2.sa_flags & SA_NOMASK) tmp |= SOLARIS_SA_NODEFER; if (s2.sa_flags & SA_NOMASK) tmp |= SOLARIS_SA_NODEFER;
if (s2.sa_flags & SA_ONESHOT) tmp |= SOLARIS_SA_RESETHAND; if (s2.sa_flags & SA_ONESHOT) tmp |= SOLARIS_SA_RESETHAND;
if (s2.sa_flags & SA_NOCLDSTOP) tmp |= SOLARIS_SA_NOCLDSTOP; if (s2.sa_flags & SA_NOCLDSTOP) tmp |= SOLARIS_SA_NOCLDSTOP;
if (put_user (tmp, &((struct sol_sigaction *)A(old))->sa_flags) || if (put_user (tmp, &p->sa_flags) ||
__put_user ((u32)(long)s2.sa_handler, &((struct sol_sigaction *)A(old))->sa_handler) || __put_user ((u32)(unsigned long)s2.sa_handler, &p->sa_handler) ||
copy_to_user (&((struct sol_sigaction *)A(old))->sa_mask, tmp2, 4*sizeof(u32))) copy_to_user (&p->sa_mask, tmp2, 4*sizeof(u32)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -323,26 +326,27 @@ asmlinkage int solaris_sigpending(int which, u32 set) ...@@ -323,26 +326,27 @@ asmlinkage int solaris_sigpending(int which, u32 set)
} }
if (mapout (&s, tmp)) return -EINVAL; if (mapout (&s, tmp)) return -EINVAL;
tmp[2] = 0; tmp[3] = 0; tmp[2] = 0; tmp[3] = 0;
if (copy_to_user ((u32 *)A(set), tmp, sizeof(tmp))) if (copy_to_user ((u32 __user *)A(set), tmp, sizeof(tmp)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
asmlinkage int solaris_wait(u32 stat_loc) asmlinkage int solaris_wait(u32 stat_loc)
{ {
int (*sys_wait4)(pid_t,unsigned int *, int, struct rusage *) = unsigned __user *p = (unsigned __user *)A(stat_loc);
(int (*)(pid_t,unsigned int *, int, struct rusage *))SYS(wait4); int (*sys_wait4)(pid_t,unsigned __user *, int, struct rusage __user *) =
(int (*)(pid_t,unsigned __user *, int, struct rusage __user *))SYS(wait4);
int ret, status; int ret, status;
ret = sys_wait4(-1, (unsigned int *)A(stat_loc), WUNTRACED, NULL); ret = sys_wait4(-1, p, WUNTRACED, NULL);
if (ret >= 0 && stat_loc) { if (ret >= 0 && stat_loc) {
if (get_user (status, (unsigned int *)A(stat_loc))) if (get_user (status, p))
return -EFAULT; return -EFAULT;
if (((status - 1) & 0xffff) < 0xff) if (((status - 1) & 0xffff) < 0xff)
status = linux_to_solaris_signals[status & 0x7f] & 0x7f; status = linux_to_solaris_signals[status & 0x7f] & 0x7f;
else if ((status & 0xff) == 0x7f) else if ((status & 0xff) == 0x7f)
status = (linux_to_solaris_signals[(status >> 8) & 0xff] << 8) | 0x7f; status = (linux_to_solaris_signals[(status >> 8) & 0xff] << 8) | 0x7f;
if (__put_user (status, (unsigned int *)A(stat_loc))) if (__put_user (status, p))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -350,8 +354,8 @@ asmlinkage int solaris_wait(u32 stat_loc) ...@@ -350,8 +354,8 @@ asmlinkage int solaris_wait(u32 stat_loc)
asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options) asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options)
{ {
int (*sys_wait4)(pid_t,unsigned int *, int, struct rusage *) = int (*sys_wait4)(pid_t,unsigned __user *, int, struct rusage __user *) =
(int (*)(pid_t,unsigned int *, int, struct rusage *))SYS(wait4); (int (*)(pid_t,unsigned __user *, int, struct rusage __user *))SYS(wait4);
int opts, status, ret; int opts, status, ret;
switch (idtype) { switch (idtype) {
...@@ -364,12 +368,12 @@ asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options) ...@@ -364,12 +368,12 @@ asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options)
if (options & SOLARIS_WUNTRACED) opts |= WUNTRACED; if (options & SOLARIS_WUNTRACED) opts |= WUNTRACED;
if (options & SOLARIS_WNOHANG) opts |= WNOHANG; if (options & SOLARIS_WNOHANG) opts |= WNOHANG;
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
ret = sys_wait4(pid, (unsigned int *)A(info), opts, NULL); ret = sys_wait4(pid, (unsigned int __user *)A(info), opts, NULL);
if (ret < 0) return ret; if (ret < 0) return ret;
if (info) { if (info) {
struct sol_siginfo *s = (struct sol_siginfo *)A(info); struct sol_siginfo __user *s = (void __user *)A(info);
if (get_user (status, (unsigned int *)A(info))) if (get_user (status, (unsigned int __user *)A(info)))
return -EFAULT; return -EFAULT;
if (__put_user (SOLARIS_SIGCLD, &s->si_signo) || if (__put_user (SOLARIS_SIGCLD, &s->si_signo) ||
......
...@@ -132,18 +132,18 @@ asmlinkage int solaris_getsockopt(int fd, int level, int optname, u32 optval, u3 ...@@ -132,18 +132,18 @@ asmlinkage int solaris_getsockopt(int fd, int level, int optname, u32 optval, u3
return sunos_getsockopt(fd, level, optname, optval, optlen); return sunos_getsockopt(fd, level, optname, optval, optlen);
} }
asmlinkage int solaris_connect(int fd, struct sockaddr *addr, int addrlen) asmlinkage int solaris_connect(int fd, struct sockaddr __user *addr, int addrlen)
{ {
int (*sys_connect)(int, struct sockaddr *, int) = int (*sys_connect)(int, struct sockaddr __user *, int) =
(int (*)(int, struct sockaddr *, int))SYS(connect); (int (*)(int, struct sockaddr __user *, int))SYS(connect);
return sys_connect(fd, addr, addrlen); return sys_connect(fd, addr, addrlen);
} }
asmlinkage int solaris_accept(int fd, struct sockaddr *addr, int *addrlen) asmlinkage int solaris_accept(int fd, struct sockaddr __user *addr, int __user *addrlen)
{ {
int (*sys_accept)(int, struct sockaddr *, int *) = int (*sys_accept)(int, struct sockaddr __user *, int __user *) =
(int (*)(int, struct sockaddr *, int *))SYS(accept); (int (*)(int, struct sockaddr __user *, int __user *))SYS(accept);
return sys_accept(fd, addr, addrlen); return sys_accept(fd, addr, addrlen);
} }
...@@ -197,28 +197,28 @@ static int linux_to_solaris_msgflags(int flags) ...@@ -197,28 +197,28 @@ static int linux_to_solaris_msgflags(int flags)
return fl; return fl;
} }
asmlinkage int solaris_recvfrom(int s, char *buf, int len, int flags, u32 from, u32 fromlen) asmlinkage int solaris_recvfrom(int s, char __user *buf, int len, int flags, u32 from, u32 fromlen)
{ {
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(from), (int *)A(fromlen)); return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), A(from), A(fromlen));
} }
asmlinkage int solaris_recv(int s, char *buf, int len, int flags) asmlinkage int solaris_recv(int s, char __user *buf, int len, int flags)
{ {
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), NULL, NULL); return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), NULL, NULL);
} }
asmlinkage int solaris_sendto(int s, char *buf, int len, int flags, u32 to, u32 tolen) asmlinkage int solaris_sendto(int s, char __user *buf, int len, int flags, u32 to, u32 tolen)
{ {
int (*sys_sendto)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(sendto); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(sendto);
return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(to), (int *)A(tolen)); return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), A(to), A(tolen));
} }
asmlinkage int solaris_send(int s, char *buf, int len, int flags) asmlinkage int solaris_send(int s, char *buf, int len, int flags)
...@@ -269,7 +269,7 @@ struct sol_cmsghdr { ...@@ -269,7 +269,7 @@ struct sol_cmsghdr {
}; };
static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
struct sol_nmsghdr *umsg) struct sol_nmsghdr __user *umsg)
{ {
u32 tmp1, tmp2, tmp3; u32 tmp1, tmp2, tmp3;
int err; int err;
...@@ -280,9 +280,9 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, ...@@ -280,9 +280,9 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
if (err) if (err)
return -EFAULT; return -EFAULT;
kmsg->msg_name = (void *)A(tmp1); kmsg->msg_name = A(tmp1);
kmsg->msg_iov = (struct iovec *)A(tmp2); kmsg->msg_iov = A(tmp2);
kmsg->msg_control = (void *)A(tmp3); kmsg->msg_control = A(tmp3);
err = get_user(kmsg->msg_namelen, &umsg->msg_namelen); err = get_user(kmsg->msg_namelen, &umsg->msg_namelen);
err |= get_user(kmsg->msg_controllen, &umsg->msg_controllen); err |= get_user(kmsg->msg_controllen, &umsg->msg_controllen);
...@@ -293,7 +293,7 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, ...@@ -293,7 +293,7 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
return err; return err;
} }
asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned user_flags) asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsigned user_flags)
{ {
struct socket *sock; struct socket *sock;
char address[MAX_SOCK_ADDR]; char address[MAX_SOCK_ADDR];
...@@ -313,7 +313,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -313,7 +313,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
total_len = err; total_len = err;
if(kern_msg.msg_controllen) { if(kern_msg.msg_controllen) {
struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control; struct sol_cmsghdr __user *ucmsg = kern_msg.msg_control;
unsigned long *kcmsg; unsigned long *kcmsg;
compat_size_t cmlen; compat_size_t cmlen;
...@@ -356,15 +356,15 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -356,15 +356,15 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
return err; return err;
} }
asmlinkage int solaris_recvmsg(int fd, struct sol_nmsghdr *user_msg, unsigned int user_flags) asmlinkage int solaris_recvmsg(int fd, struct sol_nmsghdr __user *user_msg, unsigned int user_flags)
{ {
struct iovec iovstack[UIO_FASTIOV]; struct iovec iovstack[UIO_FASTIOV];
struct msghdr kern_msg; struct msghdr kern_msg;
char addr[MAX_SOCK_ADDR]; char addr[MAX_SOCK_ADDR];
struct socket *sock; struct socket *sock;
struct iovec *iov = iovstack; struct iovec *iov = iovstack;
struct sockaddr *uaddr; struct sockaddr __user *uaddr;
int *uaddr_len; int __user *uaddr_len;
unsigned long cmsg_ptr; unsigned long cmsg_ptr;
int err, total_len, len = 0; int err, total_len, len = 0;
......
...@@ -219,7 +219,7 @@ static void timod_ok(unsigned int fd, int prim) ...@@ -219,7 +219,7 @@ static void timod_ok(unsigned int fd, int prim)
SOLD("done"); SOLD("done");
} }
static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len, int do_ret) static int timod_optmgmt(unsigned int fd, int flag, char __user *opt_buf, int opt_len, int do_ret)
{ {
int error, failed; int error, failed;
int ret_space, ret_len; int ret_space, ret_len;
...@@ -337,8 +337,8 @@ static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len, ...@@ -337,8 +337,8 @@ static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len,
return 0; return 0;
} }
int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len,
char *data_buf, int data_len, int flags) char __user *data_buf, int data_len, int flags)
{ {
int ret, error, terror; int ret, error, terror;
char *buf; char *buf;
...@@ -347,15 +347,15 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -347,15 +347,15 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
struct sol_socket_struct *sock; struct sol_socket_struct *sock;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
long args[6]; long args[6];
int (*sys_socketcall)(int, unsigned long *) = int (*sys_socketcall)(int, unsigned long __user *) =
(int (*)(int, unsigned long *))SYS(socketcall); (int (*)(int, unsigned long __user *))SYS(socketcall);
int (*sys_sendto)(int, void *, size_t, unsigned, struct sockaddr *, int) = int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int))SYS(sendto); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto);
filp = current->files->fd[fd]; filp = current->files->fd[fd];
ino = filp->f_dentry->d_inode; ino = filp->f_dentry->d_inode;
sock = (struct sol_socket_struct *)filp->private_data; sock = (struct sol_socket_struct *)filp->private_data;
SOLD("entry"); SOLD("entry");
if (get_user(ret, (int *)A(ctl_buf))) if (get_user(ret, (int __user *)A(ctl_buf)))
return -EFAULT; return -EFAULT;
switch (ret) { switch (ret) {
case T_BIND_REQ: case T_BIND_REQ:
...@@ -596,7 +596,7 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -596,7 +596,7 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
printk("\n"); printk("\n");
} }
#endif #endif
err = sys_sendto(fd, data_buf, data_len, 0, req.DEST_length > 0 ? (struct sockaddr*)(ctl_buf+req.DEST_offset) : NULL, req.DEST_length); err = sys_sendto(fd, data_buf, data_len, 0, req.DEST_length > 0 ? (struct sockaddr __user *)(ctl_buf+req.DEST_offset) : NULL, req.DEST_length);
if (err == data_len) if (err == data_len)
return 0; return 0;
if(err >= 0) { if(err >= 0) {
...@@ -613,8 +613,8 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -613,8 +613,8 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
return -EINVAL; return -EINVAL;
} }
int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __user *ctl_len,
char *data_buf, int data_maxlen, s32 *data_len, int *flags_p) char __user *data_buf, int data_maxlen, s32 __user *data_len, int *flags_p)
{ {
int error; int error;
int oldflags; int oldflags;
...@@ -624,11 +624,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, ...@@ -624,11 +624,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
struct T_unitdata_ind udi; struct T_unitdata_ind udi;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
long args[6]; long args[6];
char *tmpbuf; char __user *tmpbuf;
int tmplen; int tmplen;
int (*sys_socketcall)(int, unsigned long *) = int (*sys_socketcall)(int, unsigned long __user *) =
(int (*)(int, unsigned long *))SYS(socketcall); (int (*)(int, unsigned long __user *))SYS(socketcall);
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *); int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *);
SOLD("entry"); SOLD("entry");
SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p));
...@@ -808,8 +808,8 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, ...@@ -808,8 +808,8 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
oldflags = filp->f_flags; oldflags = filp->f_flags;
filp->f_flags |= O_NONBLOCK; filp->f_flags |= O_NONBLOCK;
SOLD("calling recvfrom"); SOLD("calling recvfrom");
sys_recvfrom = (int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); sys_recvfrom = (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
error = sys_recvfrom(fd, data_buf, data_maxlen, 0, (struct sockaddr*)tmpbuf, ctl_len); error = sys_recvfrom(fd, data_buf, data_maxlen, 0, (struct sockaddr __user *)tmpbuf, ctl_len);
filp->f_flags = oldflags; filp->f_flags = oldflags;
if (error < 0) if (error < 0)
return error; return error;
...@@ -838,9 +838,10 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -838,9 +838,10 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
{ {
struct file *filp; struct file *filp;
struct inode *ino; struct inode *ino;
struct strbuf *ctlptr, *datptr; struct strbuf __user *ctlptr;
struct strbuf __user *datptr;
struct strbuf ctl, dat; struct strbuf ctl, dat;
int *flgptr; int __user *flgptr;
int flags; int flags;
int error = -EBADF; int error = -EBADF;
...@@ -857,9 +858,9 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -857,9 +858,9 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
if (!ino->i_sock) if (!ino->i_sock)
goto out; goto out;
ctlptr = (struct strbuf *)A(arg1); ctlptr = (struct strbuf __user *)A(arg1);
datptr = (struct strbuf *)A(arg2); datptr = (struct strbuf __user *)A(arg2);
flgptr = (int *)A(arg3); flgptr = (int __user *)A(arg3);
error = -EFAULT; error = -EFAULT;
...@@ -891,8 +892,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -891,8 +892,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
goto out; goto out;
} }
error = timod_getmsg(fd,(char*)A(ctl.buf),ctl.maxlen,&ctlptr->len, error = timod_getmsg(fd,A(ctl.buf),ctl.maxlen,&ctlptr->len,
(char*)A(dat.buf),dat.maxlen,&datptr->len,&flags); A(dat.buf),dat.maxlen,&datptr->len,&flags);
if (!error && put_user(flags,flgptr)) if (!error && put_user(flags,flgptr))
error = -EFAULT; error = -EFAULT;
...@@ -906,7 +907,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -906,7 +907,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
{ {
struct file *filp; struct file *filp;
struct inode *ino; struct inode *ino;
struct strbuf *ctlptr, *datptr; struct strbuf __user *ctlptr;
struct strbuf __user *datptr;
struct strbuf ctl, dat; struct strbuf ctl, dat;
int flags = (int) arg3; int flags = (int) arg3;
int error = -EBADF; int error = -EBADF;
...@@ -925,8 +927,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -925,8 +927,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
(imajor(ino) != 30 || iminor(ino) != 1)) (imajor(ino) != 30 || iminor(ino) != 1))
goto out; goto out;
ctlptr = (struct strbuf *)A(arg1); ctlptr = A(arg1);
datptr = (struct strbuf *)A(arg2); datptr = A(arg2);
error = -EFAULT; error = -EFAULT;
...@@ -950,8 +952,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -950,8 +952,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
dat.buf = 0; dat.buf = 0;
} }
error = timod_putmsg(fd,(char*)A(ctl.buf),ctl.len, error = timod_putmsg(fd,A(ctl.buf),ctl.len,
(char*)A(dat.buf),dat.len,flags); A(dat.buf),dat.len,flags);
out: out:
unlock_kernel(); unlock_kernel();
SOLD("done"); SOLD("done");
......
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