Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356681
b: refs/heads/master
c: 6bc43c9
h: refs/heads/master
i:
  356679: 3b2291c
v: v3
  • Loading branch information
Al Viro committed Feb 3, 2013
1 parent c0d2608 commit c6500d4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 19 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: 177b6703f62f991ca250768e23398b21f7700f91
refs/heads/master: 6bc43c9ee92b4146b56e8758cec73f0990410326
3 changes: 0 additions & 3 deletions trunk/arch/frv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ config FRV
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_CPU_DEVICES
select ARCH_WANT_IPC_PARSE_VERSION
select GENERIC_SIGALTSTACK
select OLD_SIGSUSPEND3
select OLD_SIGACTION

config ZONE_DMA
bool
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/frv/include/asm/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@

#include <uapi/asm/signal.h>

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

#endif /* _ASM_SIGNAL_H */
55 changes: 53 additions & 2 deletions trunk/arch/frv/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,55 @@ struct fdpic_func_descriptor {
unsigned long GOT;
};

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

asmlinkage int 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 (!access_ok(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 (!access_ok(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;
}

asmlinkage
int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
{
return do_sigaltstack(uss, uoss, __frame->sp);
}


/*
* Do a signal return; undo the signal stack.
*/
Expand Down Expand Up @@ -124,7 +173,7 @@ asmlinkage int sys_rt_sigreturn(void)
if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8))
goto badframe;

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

return gr8;
Expand Down Expand Up @@ -296,7 +345,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(NULL, &frame->uc.uc_link) ||
__save_altstack(&frame->uc.uc_stack, __frame->sp))
__put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) ||
__put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) ||
__put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size))
goto give_sigsegv;

if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0]))
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/h8300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config H8300
select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES
select MODULES_USE_ELF_RELA
select GENERIC_SIGALTSTACK

config SYMBOL_PREFIX
string
Expand Down
15 changes: 2 additions & 13 deletions trunk/arch/h8300/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ sys_sigaction(int sig, const struct old_sigaction *act,
return ret;
}

asmlinkage int
sys_sigaltstack(const stack_t *uss, stack_t *uoss)
{
return do_sigaltstack(uss, uoss, rdusp());
}


/*
* Do a signal return; undo the signal stack.
*
Expand Down Expand Up @@ -212,7 +205,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0))
goto badframe;

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

return er0;
Expand Down Expand Up @@ -358,11 +351,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
/* Create the ucontext. */
err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(0, &frame->uc.uc_link);
err |= __put_user((void *)current->sas_ss_sp,
&frame->uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(rdusp()),
&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, rdusp());
err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
if (err)
Expand Down

0 comments on commit c6500d4

Please sign in to comment.