[MIPS] Signal cleanup
Move function prototypes to asm/signal.h to detect trivial errors and add some __user tags to get rid of sparse warnings. Generated code should not be changed. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
6254944faf
commit
9c6031cc93
|
@ -60,17 +60,9 @@ ATTRIB_NORET void cpu_idle(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void do_signal(struct pt_regs *regs);
|
|
||||||
extern void do_signal32(struct pt_regs *regs);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Native o32 and N64 ABI without DSP ASE
|
* Native o32 and N64 ABI without DSP ASE
|
||||||
*/
|
*/
|
||||||
extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
|
|
||||||
int signr, sigset_t *set);
|
|
||||||
extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
|
|
||||||
int signr, sigset_t *set, siginfo_t *info);
|
|
||||||
|
|
||||||
struct mips_abi mips_abi = {
|
struct mips_abi mips_abi = {
|
||||||
.do_signal = do_signal,
|
.do_signal = do_signal,
|
||||||
#ifdef CONFIG_TRAD_SIGNALS
|
#ifdef CONFIG_TRAD_SIGNALS
|
||||||
|
@ -83,11 +75,6 @@ struct mips_abi mips_abi = {
|
||||||
/*
|
/*
|
||||||
* o32 compatibility on 64-bit kernels, without DSP ASE
|
* o32 compatibility on 64-bit kernels, without DSP ASE
|
||||||
*/
|
*/
|
||||||
extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
|
|
||||||
int signr, sigset_t *set);
|
|
||||||
extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
|
|
||||||
int signr, sigset_t *set, siginfo_t *info);
|
|
||||||
|
|
||||||
struct mips_abi mips_abi_32 = {
|
struct mips_abi mips_abi_32 = {
|
||||||
.do_signal = do_signal32,
|
.do_signal = do_signal32,
|
||||||
.setup_frame = setup_frame_32,
|
.setup_frame = setup_frame_32,
|
||||||
|
@ -99,9 +86,6 @@ struct mips_abi mips_abi_32 = {
|
||||||
/*
|
/*
|
||||||
* N32 on 64-bit kernels, without DSP ASE
|
* N32 on 64-bit kernels, without DSP ASE
|
||||||
*/
|
*/
|
||||||
extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
|
|
||||||
int signr, sigset_t *set, siginfo_t *info);
|
|
||||||
|
|
||||||
struct mips_abi mips_abi_n32 = {
|
struct mips_abi mips_abi_n32 = {
|
||||||
.do_signal = do_signal,
|
.do_signal = do_signal,
|
||||||
.setup_rt_frame = setup_rt_frame_n32
|
.setup_rt_frame = setup_rt_frame_n32
|
||||||
|
|
|
@ -100,8 +100,8 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_TRAD_SIGNALS
|
#ifdef CONFIG_TRAD_SIGNALS
|
||||||
asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
|
asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act,
|
||||||
struct sigaction *oact)
|
struct sigaction __user *oact)
|
||||||
{
|
{
|
||||||
struct k_sigaction new_ka, old_ka;
|
struct k_sigaction new_ka, old_ka;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -331,7 +331,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
/* Create the ucontext. */
|
/* Create the ucontext. */
|
||||||
err |= __put_user(0, &frame->rs_uc.uc_flags);
|
err |= __put_user(0, &frame->rs_uc.uc_flags);
|
||||||
err |= __put_user(NULL, &frame->rs_uc.uc_link);
|
err |= __put_user(NULL, &frame->rs_uc.uc_link);
|
||||||
err |= __put_user((void *)current->sas_ss_sp,
|
err |= __put_user((void __user *)current->sas_ss_sp,
|
||||||
&frame->rs_uc.uc_stack.ss_sp);
|
&frame->rs_uc.uc_stack.ss_sp);
|
||||||
err |= __put_user(sas_ss_flags(regs->regs[29]),
|
err |= __put_user(sas_ss_flags(regs->regs[29]),
|
||||||
&frame->rs_uc.uc_stack.ss_flags);
|
&frame->rs_uc.uc_stack.ss_flags);
|
||||||
|
|
|
@ -163,7 +163,7 @@ static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf)
|
static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
unsigned long sig[4];
|
unsigned long sig[4];
|
||||||
|
@ -195,10 +195,10 @@ save_static_function(sys32_sigsuspend);
|
||||||
__attribute_used__ noinline static int
|
__attribute_used__ noinline static int
|
||||||
_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
||||||
{
|
{
|
||||||
compat_sigset_t *uset;
|
compat_sigset_t __user *uset;
|
||||||
sigset_t newset;
|
sigset_t newset;
|
||||||
|
|
||||||
uset = (compat_sigset_t *) regs.regs[4];
|
uset = (compat_sigset_t __user *) regs.regs[4];
|
||||||
if (get_sigset(&newset, uset))
|
if (get_sigset(&newset, uset))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
sigdelsetmask(&newset, ~_BLOCKABLE);
|
sigdelsetmask(&newset, ~_BLOCKABLE);
|
||||||
|
@ -219,7 +219,7 @@ save_static_function(sys32_rt_sigsuspend);
|
||||||
__attribute_used__ noinline static int
|
__attribute_used__ noinline static int
|
||||||
_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
||||||
{
|
{
|
||||||
compat_sigset_t *uset;
|
compat_sigset_t __user *uset;
|
||||||
sigset_t newset;
|
sigset_t newset;
|
||||||
size_t sigsetsize;
|
size_t sigsetsize;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
||||||
if (sigsetsize != sizeof(compat_sigset_t))
|
if (sigsetsize != sizeof(compat_sigset_t))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
uset = (compat_sigset_t *) regs.regs[4];
|
uset = (compat_sigset_t __user *) regs.regs[4];
|
||||||
if (get_sigset(&newset, uset))
|
if (get_sigset(&newset, uset))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
sigdelsetmask(&newset, ~_BLOCKABLE);
|
sigdelsetmask(&newset, ~_BLOCKABLE);
|
||||||
|
@ -245,8 +245,8 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
|
||||||
return -ERESTARTNOHAND;
|
return -ERESTARTNOHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
|
asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act,
|
||||||
struct sigaction32 *oact)
|
struct sigaction32 __user *oact)
|
||||||
{
|
{
|
||||||
struct k_sigaction new_ka, old_ka;
|
struct k_sigaction new_ka, old_ka;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -301,7 +301,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
|
||||||
if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
|
if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
err |= __get_user(sp, &uss->ss_sp);
|
err |= __get_user(sp, &uss->ss_sp);
|
||||||
kss.ss_sp = (void *) (long) sp;
|
kss.ss_sp = (void __user *) (long) sp;
|
||||||
err |= __get_user(kss.ss_size, &uss->ss_size);
|
err |= __get_user(kss.ss_size, &uss->ss_size);
|
||||||
err |= __get_user(kss.ss_flags, &uss->ss_flags);
|
err |= __get_user(kss.ss_flags, &uss->ss_flags);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -316,7 +316,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
|
||||||
if (!ret && uoss) {
|
if (!ret && uoss) {
|
||||||
if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
|
if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
sp = (int) (long) koss.ss_sp;
|
sp = (int) (unsigned long) koss.ss_sp;
|
||||||
err |= __put_user(sp, &uoss->ss_sp);
|
err |= __put_user(sp, &uoss->ss_sp);
|
||||||
err |= __put_user(koss.ss_size, &uoss->ss_size);
|
err |= __put_user(koss.ss_size, &uoss->ss_size);
|
||||||
err |= __put_user(koss.ss_flags, &uoss->ss_flags);
|
err |= __put_user(koss.ss_flags, &uoss->ss_flags);
|
||||||
|
@ -527,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||||
/* The ucontext contains a stack32_t, so we must convert! */
|
/* The ucontext contains a stack32_t, so we must convert! */
|
||||||
if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
|
if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
st.ss_sp = (void *)(long) sp;
|
st.ss_sp = (void __user *)(long) sp;
|
||||||
if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
|
if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
|
if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
|
||||||
|
@ -868,7 +868,7 @@ no_signal:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
|
asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
|
||||||
struct sigaction32 __user *oact,
|
struct sigaction32 __user *oact,
|
||||||
unsigned int sigsetsize)
|
unsigned int sigsetsize)
|
||||||
{
|
{
|
||||||
|
@ -912,7 +912,7 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
|
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
|
||||||
compat_sigset_t __user *oset, unsigned int sigsetsize)
|
compat_sigset_t __user *oset, unsigned int sigsetsize)
|
||||||
{
|
{
|
||||||
sigset_t old_set, new_set;
|
sigset_t old_set, new_set;
|
||||||
|
|
|
@ -141,7 +141,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||||
/* The ucontext contains a stack32_t, so we must convert! */
|
/* The ucontext contains a stack32_t, so we must convert! */
|
||||||
if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
|
if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
st.ss_sp = (void *)(long) sp;
|
st.ss_sp = (void __user *)(long) sp;
|
||||||
if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
|
if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
|
if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
|
||||||
|
|
|
@ -147,16 +147,34 @@ struct k_sigaction {
|
||||||
|
|
||||||
/* IRIX compatible stack_t */
|
/* IRIX compatible stack_t */
|
||||||
typedef struct sigaltstack {
|
typedef struct sigaltstack {
|
||||||
void *ss_sp;
|
void __user *ss_sp;
|
||||||
size_t ss_size;
|
size_t ss_size;
|
||||||
int ss_flags;
|
int ss_flags;
|
||||||
} stack_t;
|
} stack_t;
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <asm/sigcontext.h>
|
#include <asm/sigcontext.h>
|
||||||
|
#include <asm/siginfo.h>
|
||||||
|
|
||||||
#define ptrace_signal_deliver(regs, cookie) do { } while (0)
|
#define ptrace_signal_deliver(regs, cookie) do { } while (0)
|
||||||
|
|
||||||
|
struct pt_regs;
|
||||||
|
extern void do_signal(struct pt_regs *regs);
|
||||||
|
extern void do_signal32(struct pt_regs *regs);
|
||||||
|
|
||||||
|
extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
|
int signr, sigset_t *set);
|
||||||
|
extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
|
int signr, sigset_t *set, siginfo_t *info);
|
||||||
|
|
||||||
|
extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
|
int signr, sigset_t *set);
|
||||||
|
extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
|
int signr, sigset_t *set, siginfo_t *info);
|
||||||
|
|
||||||
|
extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
|
||||||
|
int signr, sigset_t *set, siginfo_t *info);
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
#endif /* _ASM_SIGNAL_H */
|
#endif /* _ASM_SIGNAL_H */
|
||||||
|
|
Loading…
Reference in New Issue