[S390] signal: convert to use set_current_blocked()
Convert to use set_current_blocked() like x86. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
7a0e42f168
commit
391c62feb1
|
@ -380,20 +380,13 @@ asmlinkage long sys32_sigreturn(void)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
|
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
set_current_blocked(&set);
|
||||||
current->blocked = set;
|
|
||||||
recalc_sigpending();
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
|
|
||||||
if (restore_sigregs32(regs, &frame->sregs))
|
if (restore_sigregs32(regs, &frame->sregs))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
|
|
||||||
badframe:
|
badframe:
|
||||||
force_sig(SIGSEGV, current);
|
force_sig(SIGSEGV, current);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -413,31 +406,22 @@ asmlinkage long sys32_rt_sigreturn(void)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
|
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
set_current_blocked(&set);
|
||||||
current->blocked = set;
|
|
||||||
recalc_sigpending();
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
|
|
||||||
if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
|
if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
|
err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
|
||||||
st.ss_sp = compat_ptr(ss_sp);
|
st.ss_sp = compat_ptr(ss_sp);
|
||||||
err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
|
err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
|
||||||
err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
|
err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
|
||||||
if (err)
|
if (err)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
set_fs (KERNEL_DS);
|
set_fs (KERNEL_DS);
|
||||||
do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
|
do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
|
||||||
set_fs (old_fs);
|
set_fs (old_fs);
|
||||||
|
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
|
|
||||||
badframe:
|
badframe:
|
||||||
force_sig(SIGSEGV, current);
|
force_sig(SIGSEGV, current);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -605,10 +589,10 @@ give_sigsegv:
|
||||||
* OK, we're invoking a handler
|
* OK, we're invoking a handler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int handle_signal32(unsigned long sig, struct k_sigaction *ka,
|
||||||
handle_signal32(unsigned long sig, struct k_sigaction *ka,
|
siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
|
||||||
siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
|
|
||||||
{
|
{
|
||||||
|
sigset_t blocked;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Set up the stack frame */
|
/* Set up the stack frame */
|
||||||
|
@ -616,15 +600,12 @@ handle_signal32(unsigned long sig, struct k_sigaction *ka,
|
||||||
ret = setup_rt_frame32(sig, ka, info, oldset, regs);
|
ret = setup_rt_frame32(sig, ka, info, oldset, regs);
|
||||||
else
|
else
|
||||||
ret = setup_frame32(sig, ka, oldset, regs);
|
ret = setup_frame32(sig, ka, oldset, regs);
|
||||||
|
if (ret)
|
||||||
if (ret == 0) {
|
return ret;
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask);
|
||||||
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
if (!(ka->sa.sa_flags & SA_NODEFER))
|
||||||
if (!(ka->sa.sa_flags & SA_NODEFER))
|
sigaddset(&blocked, sig);
|
||||||
sigaddset(¤t->blocked,sig);
|
set_current_blocked(&blocked);
|
||||||
recalc_sigpending();
|
return 0;
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,17 +57,15 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
|
SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
|
||||||
{
|
{
|
||||||
mask &= _BLOCKABLE;
|
sigset_t blocked;
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
|
||||||
current->saved_sigmask = current->blocked;
|
|
||||||
siginitset(¤t->blocked, mask);
|
|
||||||
recalc_sigpending();
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
|
|
||||||
|
current->saved_sigmask = current->blocked;
|
||||||
|
mask &= _BLOCKABLE;
|
||||||
|
siginitset(&blocked, mask);
|
||||||
|
set_current_blocked(&blocked);
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
schedule();
|
schedule();
|
||||||
set_thread_flag(TIF_RESTORE_SIGMASK);
|
set_thread_flag(TIF_RESTORE_SIGMASK);
|
||||||
|
|
||||||
return -ERESTARTNOHAND;
|
return -ERESTARTNOHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,18 +170,11 @@ SYSCALL_DEFINE0(sigreturn)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
|
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
set_current_blocked(&set);
|
||||||
current->blocked = set;
|
|
||||||
recalc_sigpending();
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
|
|
||||||
if (restore_sigregs(regs, &frame->sregs))
|
if (restore_sigregs(regs, &frame->sregs))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
|
|
||||||
badframe:
|
badframe:
|
||||||
force_sig(SIGSEGV, current);
|
force_sig(SIGSEGV, current);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -199,21 +190,14 @@ SYSCALL_DEFINE0(rt_sigreturn)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set)))
|
if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set)))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
set_current_blocked(&set);
|
||||||
current->blocked = set;
|
|
||||||
recalc_sigpending();
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
|
|
||||||
if (restore_sigregs(regs, &frame->uc.uc_mcontext))
|
if (restore_sigregs(regs, &frame->uc.uc_mcontext))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
if (do_sigaltstack(&frame->uc.uc_stack, NULL,
|
if (do_sigaltstack(&frame->uc.uc_stack, NULL,
|
||||||
regs->gprs[15]) == -EFAULT)
|
regs->gprs[15]) == -EFAULT)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
|
|
||||||
badframe:
|
badframe:
|
||||||
force_sig(SIGSEGV, current);
|
force_sig(SIGSEGV, current);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -385,14 +369,11 @@ give_sigsegv:
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static int handle_signal(unsigned long sig, struct k_sigaction *ka,
|
||||||
* OK, we're invoking a handler
|
siginfo_t *info, sigset_t *oldset,
|
||||||
*/
|
struct pt_regs *regs)
|
||||||
|
|
||||||
static int
|
|
||||||
handle_signal(unsigned long sig, struct k_sigaction *ka,
|
|
||||||
siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
|
|
||||||
{
|
{
|
||||||
|
sigset_t blocked;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Set up the stack frame */
|
/* Set up the stack frame */
|
||||||
|
@ -400,17 +381,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
|
||||||
ret = setup_rt_frame(sig, ka, info, oldset, regs);
|
ret = setup_rt_frame(sig, ka, info, oldset, regs);
|
||||||
else
|
else
|
||||||
ret = setup_frame(sig, ka, oldset, regs);
|
ret = setup_frame(sig, ka, oldset, regs);
|
||||||
|
if (ret)
|
||||||
if (ret == 0) {
|
return ret;
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask);
|
||||||
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
if (!(ka->sa.sa_flags & SA_NODEFER))
|
||||||
if (!(ka->sa.sa_flags & SA_NODEFER))
|
sigaddset(&blocked, sig);
|
||||||
sigaddset(¤t->blocked,sig);
|
set_current_blocked(&blocked);
|
||||||
recalc_sigpending();
|
return 0;
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue