Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356717
b: refs/heads/master
c: faec5a9
h: refs/heads/master
i:
  356715: b8ec07c
v: v3
  • Loading branch information
Al Viro committed Feb 3, 2013
1 parent 50b2160 commit 1e39ebe
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33f9f78eec7e332dac6bee9cf66cd2bd435b7419
refs/heads/master: faec5a96a024c1256b289253f3609b4a5f6f3576
3 changes: 0 additions & 3 deletions trunk/arch/mn10300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ config MN10300
select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
select GENERIC_SIGALTSTACK
select OLD_SIGSUSPEND3
select OLD_SIGACTION

config AM33_2
def_bool n
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/mn10300/include/asm/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;

struct old_sigaction {
__sighandler_t sa_handler;
old_sigset_t sa_mask;
unsigned long sa_flags;
__sigrestore_t sa_restorer;
};

#define __ARCH_HAS_SA_RESTORER

#include <asm/sigcontext.h>
Expand Down
60 changes: 58 additions & 2 deletions trunk/arch/mn10300/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,59 @@

#define DEBUG_SIG 0

/*
* atomically swap in the new signal mask, and wait for a signal.
*/
asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
{
sigset_t blocked;
siginitset(&blocked, mask);
return sigsuspend(&blocked);
}

/*
* set signal action syscall
*/
asmlinkage long sys_sigaction(int sig,
const struct old_sigaction __user *act,
struct old_sigaction __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;

if (act) {
old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
__get_user(mask, &act->sa_mask))
return -EFAULT;
siginitset(&new_ka.sa.sa_mask, mask);
}

ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);

if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
__put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
return -EFAULT;
}

return ret;
}

/*
* set alternate signal stack syscall
*/
asmlinkage long sys_sigaltstack(const stack_t __user *uss, stack_t *uoss)
{
return do_sigaltstack(uss, uoss, current_frame()->sp);
}

/*
* do a signal return; undo the signal stack.
*/
Expand Down Expand Up @@ -140,7 +193,8 @@ asmlinkage long sys_rt_sigreturn(void)
if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0))
goto badframe;

if (restore_altstack(&frame->uc.uc_stack))
if (do_sigaltstack(&frame->uc.uc_stack, NULL, current_frame()->sp) ==
-EFAULT)
goto badframe;

return d0;
Expand Down Expand Up @@ -305,7 +359,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* create the ucontext. */
if (__put_user(0, &frame->uc.uc_flags) ||
__put_user(0, &frame->uc.uc_link) ||
__save_altstack(&frame->uc.uc_stack, regs->sp) ||
__put_user((void *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) ||
__put_user(sas_ss_flags(regs->sp), &frame->uc.uc_stack.ss_flags) ||
__put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size) ||
setup_sigcontext(&frame->uc.uc_mcontext,
&frame->fpuctx, regs, set->sig[0]) ||
__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)))
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/openrisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config OPENRISC
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
select MODULES_USE_ELF_RELA
select GENERIC_SIGALTSTACK

config MMU
def_bool y
Expand Down
4 changes: 0 additions & 4 deletions trunk/arch/openrisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,6 @@ ENTRY(__sys_fork)
l.j _fork_save_extra_regs_and_call
l.addi r3,r1,0

ENTRY(sys_sigaltstack)
l.j _sys_sigaltstack
l.addi r5,r1,0

ENTRY(sys_rt_sigreturn)
l.j _sys_rt_sigreturn
l.addi r3,r1,0
Expand Down
15 changes: 2 additions & 13 deletions trunk/arch/openrisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@

#define DEBUG_SIG 0

asmlinkage long
_sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
{
return do_sigaltstack(uss, uoss, regs->sp);
}

struct rt_sigframe {
struct siginfo *pinfo;
void *puc;
Expand Down Expand Up @@ -103,9 +97,7 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
goto badframe;

/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
if (restore_altstack(&frame->uc.uc_stack))
goto badframe;

return regs->gpr[11];
Expand Down Expand Up @@ -205,10 +197,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(NULL, &frame->uc.uc_link);
err |= __put_user((void *)current->sas_ss_sp,
&frame->uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(regs->sp), &frame->uc.uc_stack.ss_flags);
err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);

err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
Expand Down

0 comments on commit 1e39ebe

Please sign in to comment.