Commit cf3e791e authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David Mosberger

[PATCH] ia64: [COMPAT] compat_{old_}sigset_t

parent 7f7ac851
...@@ -56,7 +56,7 @@ struct sigframe_ia32 ...@@ -56,7 +56,7 @@ struct sigframe_ia32
int sig; int sig;
struct sigcontext_ia32 sc; struct sigcontext_ia32 sc;
struct _fpstate_ia32 fpstate; struct _fpstate_ia32 fpstate;
unsigned int extramask[_IA32_NSIG_WORDS-1]; unsigned int extramask[_COMPAT_NSIG_WORDS-1];
char retcode[8]; char retcode[8];
}; };
...@@ -463,7 +463,7 @@ sigact_set_handler (struct k_sigaction *sa, unsigned int handler, unsigned int r ...@@ -463,7 +463,7 @@ sigact_set_handler (struct k_sigaction *sa, unsigned int handler, unsigned int r
} }
asmlinkage long asmlinkage long
ia32_rt_sigsuspend (sigset32_t *uset, unsigned int sigsetsize, struct sigscratch *scr) ia32_rt_sigsuspend (compat_sigset_t *uset, unsigned int sigsetsize, struct sigscratch *scr)
{ {
extern long ia64_do_signal (sigset_t *oldset, struct sigscratch *scr, long in_syscall); extern long ia64_do_signal (sigset_t *oldset, struct sigscratch *scr, long in_syscall);
sigset_t oldset, set; sigset_t oldset, set;
...@@ -504,7 +504,7 @@ ia32_rt_sigsuspend (sigset32_t *uset, unsigned int sigsetsize, struct sigscratch ...@@ -504,7 +504,7 @@ ia32_rt_sigsuspend (sigset32_t *uset, unsigned int sigsetsize, struct sigscratch
asmlinkage long asmlinkage long
ia32_sigsuspend (unsigned int mask, struct sigscratch *scr) ia32_sigsuspend (unsigned int mask, struct sigscratch *scr)
{ {
return ia32_rt_sigsuspend((sigset32_t *)&mask, sizeof(mask), scr); return ia32_rt_sigsuspend((compat_sigset_t *)&mask, sizeof(mask), scr);
} }
asmlinkage long asmlinkage long
...@@ -530,14 +530,14 @@ sys32_rt_sigaction (int sig, struct sigaction32 *act, ...@@ -530,14 +530,14 @@ sys32_rt_sigaction (int sig, struct sigaction32 *act,
int ret; int ret;
/* XXX: Don't preclude handling different sized sigset_t's. */ /* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset32_t)) if (sigsetsize != sizeof(compat_sigset_t))
return -EINVAL; return -EINVAL;
if (act) { if (act) {
ret = get_user(handler, &act->sa_handler); ret = get_user(handler, &act->sa_handler);
ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags); ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags);
ret |= get_user(restorer, &act->sa_restorer); ret |= get_user(restorer, &act->sa_restorer);
ret |= copy_from_user(&new_ka.sa.sa_mask, &act->sa_mask, sizeof(sigset32_t)); ret |= copy_from_user(&new_ka.sa.sa_mask, &act->sa_mask, sizeof(compat_sigset_t));
if (ret) if (ret)
return -EFAULT; return -EFAULT;
...@@ -550,7 +550,7 @@ sys32_rt_sigaction (int sig, struct sigaction32 *act, ...@@ -550,7 +550,7 @@ sys32_rt_sigaction (int sig, struct sigaction32 *act,
ret = put_user(IA32_SA_HANDLER(&old_ka), &oact->sa_handler); ret = put_user(IA32_SA_HANDLER(&old_ka), &oact->sa_handler);
ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags); ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
ret |= put_user(IA32_SA_RESTORER(&old_ka), &oact->sa_restorer); ret |= put_user(IA32_SA_RESTORER(&old_ka), &oact->sa_restorer);
ret |= copy_to_user(&oact->sa_mask, &old_ka.sa.sa_mask, sizeof(sigset32_t)); ret |= copy_to_user(&oact->sa_mask, &old_ka.sa.sa_mask, sizeof(compat_sigset_t));
} }
return ret; return ret;
} }
...@@ -560,7 +560,7 @@ extern asmlinkage long sys_rt_sigprocmask (int how, sigset_t *set, sigset_t *ose ...@@ -560,7 +560,7 @@ extern asmlinkage long sys_rt_sigprocmask (int how, sigset_t *set, sigset_t *ose
size_t sigsetsize); size_t sigsetsize);
asmlinkage long asmlinkage long
sys32_rt_sigprocmask (int how, sigset32_t *set, sigset32_t *oset, unsigned int sigsetsize) sys32_rt_sigprocmask (int how, compat_sigset_t *set, compat_sigset_t *oset, unsigned int sigsetsize)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
sigset_t s; sigset_t s;
...@@ -589,11 +589,11 @@ sys32_rt_sigprocmask (int how, sigset32_t *set, sigset32_t *oset, unsigned int s ...@@ -589,11 +589,11 @@ sys32_rt_sigprocmask (int how, sigset32_t *set, sigset32_t *oset, unsigned int s
asmlinkage long asmlinkage long
sys32_sigprocmask (int how, unsigned int *set, unsigned int *oset) sys32_sigprocmask (int how, unsigned int *set, unsigned int *oset)
{ {
return sys32_rt_sigprocmask(how, (sigset32_t *) set, (sigset32_t *) oset, sizeof(*set)); return sys32_rt_sigprocmask(how, (compat_sigset_t *) set, (compat_sigset_t *) oset, sizeof(*set));
} }
asmlinkage long asmlinkage long
sys32_rt_sigtimedwait (sigset32_t *uthese, siginfo_t32 *uinfo, sys32_rt_sigtimedwait (compat_sigset_t *uthese, siginfo_t32 *uinfo,
struct compat_timespec *uts, unsigned int sigsetsize) struct compat_timespec *uts, unsigned int sigsetsize)
{ {
extern asmlinkage long sys_rt_sigtimedwait (const sigset_t *, siginfo_t *, extern asmlinkage long sys_rt_sigtimedwait (const sigset_t *, siginfo_t *,
...@@ -605,7 +605,7 @@ sys32_rt_sigtimedwait (sigset32_t *uthese, siginfo_t32 *uinfo, ...@@ -605,7 +605,7 @@ sys32_rt_sigtimedwait (sigset32_t *uthese, siginfo_t32 *uinfo,
sigset_t s; sigset_t s;
int ret; int ret;
if (copy_from_user(&s.sig, uthese, sizeof(sigset32_t))) if (copy_from_user(&s.sig, uthese, sizeof(compat_sigset_t)))
return -EFAULT; return -EFAULT;
if (uts && get_compat_timespec(&t, uts)) if (uts && get_compat_timespec(&t, uts))
return -EFAULT; return -EFAULT;
...@@ -645,7 +645,7 @@ sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *o ...@@ -645,7 +645,7 @@ sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *o
int ret; int ret;
if (act) { if (act) {
old_sigset32_t mask; compat_old_sigset_t mask;
ret = get_user(handler, &act->sa_handler); ret = get_user(handler, &act->sa_handler);
ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags); ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags);
...@@ -863,7 +863,7 @@ setup_frame_ia32 (int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs ...@@ -863,7 +863,7 @@ setup_frame_ia32 (int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs
err |= setup_sigcontext_ia32(&frame->sc, &frame->fpstate, regs, set->sig[0]); err |= setup_sigcontext_ia32(&frame->sc, &frame->fpstate, regs, set->sig[0]);
if (_IA32_NSIG_WORDS > 1) if (_COMPAT_NSIG_WORDS > 1)
err |= __copy_to_user(frame->extramask, (char *) &set->sig + 4, err |= __copy_to_user(frame->extramask, (char *) &set->sig + 4,
sizeof(frame->extramask)); sizeof(frame->extramask));
...@@ -1008,7 +1008,7 @@ sys32_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int ...@@ -1008,7 +1008,7 @@ sys32_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
|| (_IA32_NSIG_WORDS > 1 && __copy_from_user((char *) &set.sig + 4, &frame->extramask, || (_COMPAT_NSIG_WORDS > 1 && __copy_from_user((char *) &set.sig + 4, &frame->extramask,
sizeof(frame->extramask)))) sizeof(frame->extramask))))
goto badframe; goto badframe;
......
...@@ -68,4 +68,11 @@ struct compat_flock { ...@@ -68,4 +68,11 @@ struct compat_flock {
compat_pid_t l_pid; compat_pid_t l_pid;
}; };
typedef u32 compat_old_sigset_t; /* at least 32 bits */
#define _COMPAT_NSIG 64
#define _COMPAT_NSIG_BPW 32
typedef u32 compat_sigset_word;
#endif /* _ASM_IA64_COMPAT_H */ #endif /* _ASM_IA64_COMPAT_H */
...@@ -132,10 +132,6 @@ struct ia32_user_fxsr_struct { ...@@ -132,10 +132,6 @@ struct ia32_user_fxsr_struct {
}; };
/* signal.h */ /* signal.h */
#define _IA32_NSIG 64
#define _IA32_NSIG_BPW 32
#define _IA32_NSIG_WORDS (_IA32_NSIG / _IA32_NSIG_BPW)
#define IA32_SET_SA_HANDLER(ka,handler,restorer) \ #define IA32_SET_SA_HANDLER(ka,handler,restorer) \
((ka)->sa.sa_handler = (__sighandler_t) \ ((ka)->sa.sa_handler = (__sighandler_t) \
(((unsigned long)(restorer) << 32) \ (((unsigned long)(restorer) << 32) \
...@@ -143,23 +139,17 @@ struct ia32_user_fxsr_struct { ...@@ -143,23 +139,17 @@ struct ia32_user_fxsr_struct {
#define IA32_SA_HANDLER(ka) ((unsigned long) (ka)->sa.sa_handler & 0xffffffff) #define IA32_SA_HANDLER(ka) ((unsigned long) (ka)->sa.sa_handler & 0xffffffff)
#define IA32_SA_RESTORER(ka) ((unsigned long) (ka)->sa.sa_handler >> 32) #define IA32_SA_RESTORER(ka) ((unsigned long) (ka)->sa.sa_handler >> 32)
typedef struct {
unsigned int sig[_IA32_NSIG_WORDS];
} sigset32_t;
struct sigaction32 { struct sigaction32 {
unsigned int sa_handler; /* Really a pointer, but need to deal with 32 bits */ unsigned int sa_handler; /* Really a pointer, but need to deal with 32 bits */
unsigned int sa_flags; unsigned int sa_flags;
unsigned int sa_restorer; /* Another 32 bit pointer */ unsigned int sa_restorer; /* Another 32 bit pointer */
sigset32_t sa_mask; /* A 32 bit mask */ compat_sigset_t sa_mask; /* A 32 bit mask */
}; };
typedef unsigned int old_sigset32_t; /* at least 32 bits */
struct old_sigaction32 { struct old_sigaction32 {
unsigned int sa_handler; /* Really a pointer, but need to deal unsigned int sa_handler; /* Really a pointer, but need to deal
with 32 bits */ with 32 bits */
old_sigset32_t sa_mask; /* A 32 bit mask */ compat_old_sigset_t sa_mask; /* A 32 bit mask */
unsigned int sa_flags; unsigned int sa_flags;
unsigned int sa_restorer; /* Another 32 bit pointer */ unsigned int sa_restorer; /* Another 32 bit pointer */
}; };
......
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