diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-09 12:58:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-09 12:58:12 -0400 |
commit | 63b12bdb0d21aca527996fb2c547387bfd3e14b8 (patch) | |
tree | 6ab83b2a1c289f30fea18b88f04138ee69c37c6f /arch/parisc | |
parent | ad1f5caf34390bb20fdbb4eaf71b0494e89936f0 (diff) | |
parent | 059ade650ae57cfd371af690fdba887af04aded8 (diff) |
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/parisc')
-rw-r--r-- | arch/parisc/kernel/signal.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 1cba8f29bb49..012d4fa63d97 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -227,8 +227,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_sysc | |||
227 | } | 227 | } |
228 | 228 | ||
229 | static long | 229 | static long |
230 | setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 230 | setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs, |
231 | sigset_t *set, struct pt_regs *regs, int in_syscall) | 231 | int in_syscall) |
232 | { | 232 | { |
233 | struct rt_sigframe __user *frame; | 233 | struct rt_sigframe __user *frame; |
234 | unsigned long rp, usp; | 234 | unsigned long rp, usp; |
@@ -241,10 +241,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
241 | 241 | ||
242 | usp = (regs->gr[30] & ~(0x01UL)); | 242 | usp = (regs->gr[30] & ~(0x01UL)); |
243 | /*FIXME: frame_size parameter is unused, remove it. */ | 243 | /*FIXME: frame_size parameter is unused, remove it. */ |
244 | frame = get_sigframe(ka, usp, sizeof(*frame)); | 244 | frame = get_sigframe(&ksig->ka, usp, sizeof(*frame)); |
245 | 245 | ||
246 | DBG(1,"SETUP_RT_FRAME: START\n"); | 246 | DBG(1,"SETUP_RT_FRAME: START\n"); |
247 | DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info); | 247 | DBG(1,"setup_rt_frame: frame %p info %p\n", frame, ksig->info); |
248 | 248 | ||
249 | 249 | ||
250 | #ifdef CONFIG_64BIT | 250 | #ifdef CONFIG_64BIT |
@@ -253,7 +253,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
253 | 253 | ||
254 | if (is_compat_task()) { | 254 | if (is_compat_task()) { |
255 | DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); | 255 | DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); |
256 | err |= copy_siginfo_to_user32(&compat_frame->info, info); | 256 | err |= copy_siginfo_to_user32(&compat_frame->info, &ksig->info); |
257 | err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]); | 257 | err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]); |
258 | DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); | 258 | DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); |
259 | DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); | 259 | DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); |
@@ -265,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
265 | #endif | 265 | #endif |
266 | { | 266 | { |
267 | DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); | 267 | DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); |
268 | err |= copy_siginfo_to_user(&frame->info, info); | 268 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
269 | err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]); | 269 | err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]); |
270 | DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); | 270 | DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); |
271 | DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); | 271 | DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); |
@@ -275,7 +275,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
275 | } | 275 | } |
276 | 276 | ||
277 | if (err) | 277 | if (err) |
278 | goto give_sigsegv; | 278 | return -EFAULT; |
279 | 279 | ||
280 | /* Set up to return from userspace. If provided, use a stub | 280 | /* Set up to return from userspace. If provided, use a stub |
281 | already in userspace. The first words of tramp are used to | 281 | already in userspace. The first words of tramp are used to |
@@ -312,9 +312,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
312 | rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP]; | 312 | rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP]; |
313 | 313 | ||
314 | if (err) | 314 | if (err) |
315 | goto give_sigsegv; | 315 | return -EFAULT; |
316 | 316 | ||
317 | haddr = A(ka->sa.sa_handler); | 317 | haddr = A(ksig->ka.sa.sa_handler); |
318 | /* The sa_handler may be a pointer to a function descriptor */ | 318 | /* The sa_handler may be a pointer to a function descriptor */ |
319 | #ifdef CONFIG_64BIT | 319 | #ifdef CONFIG_64BIT |
320 | if (is_compat_task()) { | 320 | if (is_compat_task()) { |
@@ -326,7 +326,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
326 | err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); | 326 | err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); |
327 | 327 | ||
328 | if (err) | 328 | if (err) |
329 | goto give_sigsegv; | 329 | return -EFAULT; |
330 | 330 | ||
331 | haddr = fdesc.addr; | 331 | haddr = fdesc.addr; |
332 | regs->gr[19] = fdesc.gp; | 332 | regs->gr[19] = fdesc.gp; |
@@ -339,7 +339,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
339 | err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); | 339 | err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); |
340 | 340 | ||
341 | if (err) | 341 | if (err) |
342 | goto give_sigsegv; | 342 | return -EFAULT; |
343 | 343 | ||
344 | haddr = fdesc.addr; | 344 | haddr = fdesc.addr; |
345 | regs->gr[19] = fdesc.gp; | 345 | regs->gr[19] = fdesc.gp; |
@@ -386,7 +386,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
386 | } | 386 | } |
387 | 387 | ||
388 | regs->gr[2] = rp; /* userland return pointer */ | 388 | regs->gr[2] = rp; /* userland return pointer */ |
389 | regs->gr[26] = sig; /* signal number */ | 389 | regs->gr[26] = ksig->sig; /* signal number */ |
390 | 390 | ||
391 | #ifdef CONFIG_64BIT | 391 | #ifdef CONFIG_64BIT |
392 | if (is_compat_task()) { | 392 | if (is_compat_task()) { |
@@ -410,11 +410,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
410 | current->comm, current->pid, frame, regs->gr[30], | 410 | current->comm, current->pid, frame, regs->gr[30], |
411 | regs->iaoq[0], regs->iaoq[1], rp); | 411 | regs->iaoq[0], regs->iaoq[1], rp); |
412 | 412 | ||
413 | return 1; | ||
414 | |||
415 | give_sigsegv: | ||
416 | DBG(1,"setup_rt_frame: sending SIGSEGV\n"); | ||
417 | force_sigsegv(sig, current); | ||
418 | return 0; | 413 | return 0; |
419 | } | 414 | } |
420 | 415 | ||
@@ -423,20 +418,19 @@ give_sigsegv: | |||
423 | */ | 418 | */ |
424 | 419 | ||
425 | static void | 420 | static void |
426 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 421 | handle_signal(struct ksignal *ksig, struct pt_regs *regs, int in_syscall) |
427 | struct pt_regs *regs, int in_syscall) | ||
428 | { | 422 | { |
423 | int ret; | ||
429 | sigset_t *oldset = sigmask_to_save(); | 424 | sigset_t *oldset = sigmask_to_save(); |
425 | |||
430 | DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", | 426 | DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", |
431 | sig, ka, info, oldset, regs); | 427 | ksig->sig, ksig->ka, ksig->info, oldset, regs); |
432 | 428 | ||
433 | /* Set up the stack frame */ | 429 | /* Set up the stack frame */ |
434 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) | 430 | ret = setup_rt_frame(ksig, oldset, regs, in_syscall); |
435 | return; | ||
436 | 431 | ||
437 | signal_delivered(sig, info, ka, regs, | 432 | signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP) || |
438 | test_thread_flag(TIF_SINGLESTEP) || | 433 | test_thread_flag(TIF_BLOCKSTEP)); |
439 | test_thread_flag(TIF_BLOCKSTEP)); | ||
440 | 434 | ||
441 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | 435 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", |
442 | regs->gr[28]); | 436 | regs->gr[28]); |
@@ -544,22 +538,18 @@ insert_restart_trampoline(struct pt_regs *regs) | |||
544 | asmlinkage void | 538 | asmlinkage void |
545 | do_signal(struct pt_regs *regs, long in_syscall) | 539 | do_signal(struct pt_regs *regs, long in_syscall) |
546 | { | 540 | { |
547 | siginfo_t info; | 541 | struct ksignal ksig; |
548 | struct k_sigaction ka; | ||
549 | int signr; | ||
550 | 542 | ||
551 | DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", | 543 | DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", |
552 | regs, regs->sr[7], in_syscall); | 544 | regs, regs->sr[7], in_syscall); |
553 | 545 | ||
554 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 546 | if (get_signal(&ksig)) { |
555 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); | 547 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); |
556 | |||
557 | if (signr > 0) { | ||
558 | /* Restart a system call if necessary. */ | 548 | /* Restart a system call if necessary. */ |
559 | if (in_syscall) | 549 | if (in_syscall) |
560 | syscall_restart(regs, &ka); | 550 | syscall_restart(regs, &ksig.ka); |
561 | 551 | ||
562 | handle_signal(signr, &info, &ka, regs, in_syscall); | 552 | handle_signal(&ksig, regs, in_syscall); |
563 | return; | 553 | return; |
564 | } | 554 | } |
565 | 555 | ||