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/xtensa | |
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/xtensa')
-rw-r--r-- | arch/xtensa/kernel/signal.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index 98b67d5f1514..4612321c73cc 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -331,17 +331,17 @@ gen_return_code(unsigned char *codemem) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | 333 | ||
334 | static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 334 | static int setup_frame(struct ksignal *ksig, sigset_t *set, |
335 | sigset_t *set, struct pt_regs *regs) | 335 | struct pt_regs *regs) |
336 | { | 336 | { |
337 | struct rt_sigframe *frame; | 337 | struct rt_sigframe *frame; |
338 | int err = 0; | 338 | int err = 0, sig = ksig->sig; |
339 | int signal; | 339 | int signal; |
340 | unsigned long sp, ra, tp; | 340 | unsigned long sp, ra, tp; |
341 | 341 | ||
342 | sp = regs->areg[1]; | 342 | sp = regs->areg[1]; |
343 | 343 | ||
344 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) { | 344 | if ((ksig->ka.sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) { |
345 | sp = current->sas_ss_sp + current->sas_ss_size; | 345 | sp = current->sas_ss_sp + current->sas_ss_size; |
346 | } | 346 | } |
347 | 347 | ||
@@ -351,7 +351,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
351 | panic ("Double exception sys_sigreturn\n"); | 351 | panic ("Double exception sys_sigreturn\n"); |
352 | 352 | ||
353 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) { | 353 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) { |
354 | goto give_sigsegv; | 354 | return -EFAULT; |
355 | } | 355 | } |
356 | 356 | ||
357 | signal = current_thread_info()->exec_domain | 357 | signal = current_thread_info()->exec_domain |
@@ -360,8 +360,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
360 | ? current_thread_info()->exec_domain->signal_invmap[sig] | 360 | ? current_thread_info()->exec_domain->signal_invmap[sig] |
361 | : sig; | 361 | : sig; |
362 | 362 | ||
363 | if (ka->sa.sa_flags & SA_SIGINFO) { | 363 | if (ksig->ka.sa.sa_flags & SA_SIGINFO) { |
364 | err |= copy_siginfo_to_user(&frame->info, info); | 364 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
365 | } | 365 | } |
366 | 366 | ||
367 | /* Create the user context. */ | 367 | /* Create the user context. */ |
@@ -372,8 +372,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
372 | err |= setup_sigcontext(frame, regs); | 372 | err |= setup_sigcontext(frame, regs); |
373 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 373 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
374 | 374 | ||
375 | if (ka->sa.sa_flags & SA_RESTORER) { | 375 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |
376 | ra = (unsigned long)ka->sa.sa_restorer; | 376 | ra = (unsigned long)ksig->ka.sa.sa_restorer; |
377 | } else { | 377 | } else { |
378 | 378 | ||
379 | /* Create sys_rt_sigreturn syscall in stack frame */ | 379 | /* Create sys_rt_sigreturn syscall in stack frame */ |
@@ -381,7 +381,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
381 | err |= gen_return_code(frame->retcode); | 381 | err |= gen_return_code(frame->retcode); |
382 | 382 | ||
383 | if (err) { | 383 | if (err) { |
384 | goto give_sigsegv; | 384 | return -EFAULT; |
385 | } | 385 | } |
386 | ra = (unsigned long) frame->retcode; | 386 | ra = (unsigned long) frame->retcode; |
387 | } | 387 | } |
@@ -393,7 +393,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
393 | 393 | ||
394 | /* Set up registers for signal handler; preserve the threadptr */ | 394 | /* Set up registers for signal handler; preserve the threadptr */ |
395 | tp = regs->threadptr; | 395 | tp = regs->threadptr; |
396 | start_thread(regs, (unsigned long) ka->sa.sa_handler, | 396 | start_thread(regs, (unsigned long) ksig->ka.sa.sa_handler, |
397 | (unsigned long) frame); | 397 | (unsigned long) frame); |
398 | 398 | ||
399 | /* Set up a stack frame for a call4 | 399 | /* Set up a stack frame for a call4 |
@@ -416,10 +416,6 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
416 | #endif | 416 | #endif |
417 | 417 | ||
418 | return 0; | 418 | return 0; |
419 | |||
420 | give_sigsegv: | ||
421 | force_sigsegv(sig, current); | ||
422 | return -EFAULT; | ||
423 | } | 419 | } |
424 | 420 | ||
425 | /* | 421 | /* |
@@ -433,15 +429,11 @@ give_sigsegv: | |||
433 | */ | 429 | */ |
434 | static void do_signal(struct pt_regs *regs) | 430 | static void do_signal(struct pt_regs *regs) |
435 | { | 431 | { |
436 | siginfo_t info; | 432 | struct ksignal ksig; |
437 | int signr; | ||
438 | struct k_sigaction ka; | ||
439 | 433 | ||
440 | task_pt_regs(current)->icountlevel = 0; | 434 | task_pt_regs(current)->icountlevel = 0; |
441 | 435 | ||
442 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 436 | if (get_signal(&ksig)) { |
443 | |||
444 | if (signr > 0) { | ||
445 | int ret; | 437 | int ret; |
446 | 438 | ||
447 | /* Are we from a system call? */ | 439 | /* Are we from a system call? */ |
@@ -457,7 +449,7 @@ static void do_signal(struct pt_regs *regs) | |||
457 | break; | 449 | break; |
458 | 450 | ||
459 | case -ERESTARTSYS: | 451 | case -ERESTARTSYS: |
460 | if (!(ka.sa.sa_flags & SA_RESTART)) { | 452 | if (!(ksig.ka.sa.sa_flags & SA_RESTART)) { |
461 | regs->areg[2] = -EINTR; | 453 | regs->areg[2] = -EINTR; |
462 | break; | 454 | break; |
463 | } | 455 | } |
@@ -476,11 +468,8 @@ static void do_signal(struct pt_regs *regs) | |||
476 | 468 | ||
477 | /* Whee! Actually deliver the signal. */ | 469 | /* Whee! Actually deliver the signal. */ |
478 | /* Set up the stack frame */ | 470 | /* Set up the stack frame */ |
479 | ret = setup_frame(signr, &ka, &info, sigmask_to_save(), regs); | 471 | ret = setup_frame(&ksig, sigmask_to_save(), regs); |
480 | if (ret) | 472 | signal_setup_done(ret, &ksig, 0); |
481 | return; | ||
482 | |||
483 | signal_delivered(signr, &info, &ka, regs, 0); | ||
484 | if (current->ptrace & PT_SINGLESTEP) | 473 | if (current->ptrace & PT_SINGLESTEP) |
485 | task_pt_regs(current)->icountlevel = 1; | 474 | task_pt_regs(current)->icountlevel = 1; |
486 | 475 | ||