diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-09 09:58:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-09 09:58:12 -0700 |
commit | 63b12bdb0d21aca527996fb2c547387bfd3e14b8 (patch) | |
tree | 6ab83b2a1c289f30fea18b88f04138ee69c37c6f /arch/avr32 | |
parent | ad1f5caf34390bb20fdbb4eaf71b0494e89936f0 (diff) | |
parent | 059ade650ae57cfd371af690fdba887af04aded8 (diff) | |
download | linux-63b12bdb0d21aca527996fb2c547387bfd3e14b8.tar.gz linux-63b12bdb0d21aca527996fb2c547387bfd3e14b8.tar.bz2 linux-63b12bdb0d21aca527996fb2c547387bfd3e14b8.zip |
Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc
Pull arch signal handling cleanup from Richard Weinberger:
"This patch series moves all remaining archs to the get_signal(),
signal_setup_done() and sigsp() functions.
Currently these archs use open coded variants of the said functions.
Further, unused parameters get removed from get_signal_to_deliver(),
tracehook_signal_handler() and signal_delivered().
At the end of the day we save around 500 lines of code."
* 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc: (43 commits)
powerpc: Use sigsp()
openrisc: Use sigsp()
mn10300: Use sigsp()
mips: Use sigsp()
microblaze: Use sigsp()
metag: Use sigsp()
m68k: Use sigsp()
m32r: Use sigsp()
hexagon: Use sigsp()
frv: Use sigsp()
cris: Use sigsp()
c6x: Use sigsp()
blackfin: Use sigsp()
avr32: Use sigsp()
arm64: Use sigsp()
arc: Use sigsp()
sas_ss_flags: Remove nested ternary if
Rip out get_signal_to_deliver()
Clean up signal_delivered()
tracehook_signal_handler: Remove sig, info, ka and regs
...
Diffstat (limited to 'arch/avr32')
-rw-r--r-- | arch/avr32/kernel/signal.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index b80c0b3d2bab..d309fbcc3bd6 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c @@ -127,24 +127,20 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs) } static inline void __user * -get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) +get_sigframe(struct ksignal *ksig, struct pt_regs *regs, int framesize) { - unsigned long sp = regs->sp; - - if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp)) - sp = current->sas_ss_sp + current->sas_ss_size; + unsigned long sp = sigsp(regs->sp, ksig); return (void __user *)((sp - framesize) & ~3); } static int -setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs *regs) +setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { struct rt_sigframe __user *frame; int err = 0; - frame = get_sigframe(ka, regs, sizeof(*frame)); + frame = get_sigframe(ksig, regs, sizeof(*frame)); err = -EFAULT; if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) goto out; @@ -164,7 +160,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err = __put_user(0x3008d733 | (__NR_rt_sigreturn << 20), &frame->retcode); - err |= copy_siginfo_to_user(&frame->info, info); + err |= copy_siginfo_to_user(&frame->info, &ksig->info); /* Set up the ucontext */ err |= __put_user(0, &frame->uc.uc_flags); @@ -176,12 +172,12 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, if (err) goto out; - regs->r12 = sig; + regs->r12 = ksig->sig; regs->r11 = (unsigned long) &frame->info; regs->r10 = (unsigned long) &frame->uc; regs->sp = (unsigned long) frame; - if (ka->sa.sa_flags & SA_RESTORER) - regs->lr = (unsigned long)ka->sa.sa_restorer; + if (ksig->ka.sa.sa_flags & SA_RESTORER) + regs->lr = (unsigned long)ksig->ka.sa.sa_restorer; else { printk(KERN_NOTICE "[%s:%d] did not set SA_RESTORER\n", current->comm, current->pid); @@ -189,10 +185,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, } pr_debug("SIG deliver [%s:%d]: sig=%d sp=0x%lx pc=0x%lx->0x%p lr=0x%lx\n", - current->comm, current->pid, sig, regs->sp, - regs->pc, ka->sa.sa_handler, regs->lr); + current->comm, current->pid, ksig->sig, regs->sp, + regs->pc, ksig->ka.sa.sa_handler, regs->lr); - regs->pc = (unsigned long) ka->sa.sa_handler; + regs->pc = (unsigned long)ksig->ka.sa.sa_handler; out: return err; @@ -208,15 +204,14 @@ static inline void setup_syscall_restart(struct pt_regs *regs) } static inline void -handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, - struct pt_regs *regs, int syscall) +handle_signal(struct ksignal *ksig, struct pt_regs *regs, int syscall) { int ret; /* * Set up the stack frame */ - ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); + ret = setup_rt_frame(ksig, sigmask_to_save(), regs); /* * Check that the resulting registers are sane @@ -226,10 +221,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, /* * Block the signal if we were successful. */ - if (ret != 0) - force_sigsegv(sig, current); - else - signal_delivered(sig, info, ka, regs, 0); + signal_setup_done(ret, ksig, 0); } /* @@ -239,9 +231,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, */ static void do_signal(struct pt_regs *regs, int syscall) { - siginfo_t info; - int signr; - struct k_sigaction ka; + struct ksignal ksig; /* * We want the common case to go fast, which is why we may in @@ -251,18 +241,18 @@ static void do_signal(struct pt_regs *regs, int syscall) if (!user_mode(regs)) return; - signr = get_signal_to_deliver(&info, &ka, regs, NULL); + get_signal(&ksig); if (syscall) { switch (regs->r12) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: - if (signr > 0) { + if (ksig.sig > 0) { regs->r12 = -EINTR; break; } /* fall through */ case -ERESTARTSYS: - if (signr > 0 && !(ka.sa.sa_flags & SA_RESTART)) { + if (ksig.sig > 0 && !(ksig.ka.sa.sa_flags & SA_RESTART)) { regs->r12 = -EINTR; break; } @@ -272,13 +262,13 @@ static void do_signal(struct pt_regs *regs, int syscall) } } - if (signr == 0) { + if (!ksig.sig) { /* No signal to deliver -- put the saved sigmask back */ restore_saved_sigmask(); return; } - handle_signal(signr, &ka, &info, regs, syscall); + handle_signal(&ksig, regs, syscall); } asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) |