diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2010-09-26 14:28:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-27 15:19:53 -0400 |
commit | 00cbf6080c7d60b999864afcd9010e0bbc7c5db6 (patch) | |
tree | 19ee4371be3b21d3de8cf1cfb539776ce8387c54 /arch | |
parent | e46924d246e028c94689087db0699438343a344e (diff) |
mn10300: prevent double syscall restarts
set ->orig_d0 to -1, same as what sigreturn does
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mn10300/kernel/signal.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 57178a8d5af0..4ef99256fa49 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -432,6 +432,12 @@ give_sigsegv: | |||
432 | return -EFAULT; | 432 | return -EFAULT; |
433 | } | 433 | } |
434 | 434 | ||
435 | static inline void stepback(struct pt_regs *regs) | ||
436 | { | ||
437 | regs->pc -= 2; | ||
438 | regs->orig_d0 = -1; | ||
439 | } | ||
440 | |||
435 | /* | 441 | /* |
436 | * handle the actual delivery of a signal to userspace | 442 | * handle the actual delivery of a signal to userspace |
437 | */ | 443 | */ |
@@ -459,7 +465,7 @@ static int handle_signal(int sig, | |||
459 | /* fallthrough */ | 465 | /* fallthrough */ |
460 | case -ERESTARTNOINTR: | 466 | case -ERESTARTNOINTR: |
461 | regs->d0 = regs->orig_d0; | 467 | regs->d0 = regs->orig_d0; |
462 | regs->pc -= 2; | 468 | stepback(regs); |
463 | } | 469 | } |
464 | } | 470 | } |
465 | 471 | ||
@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs) | |||
527 | case -ERESTARTSYS: | 533 | case -ERESTARTSYS: |
528 | case -ERESTARTNOINTR: | 534 | case -ERESTARTNOINTR: |
529 | regs->d0 = regs->orig_d0; | 535 | regs->d0 = regs->orig_d0; |
530 | regs->pc -= 2; | 536 | stepback(regs); |
531 | break; | 537 | break; |
532 | 538 | ||
533 | case -ERESTART_RESTARTBLOCK: | 539 | case -ERESTART_RESTARTBLOCK: |
534 | regs->d0 = __NR_restart_syscall; | 540 | regs->d0 = __NR_restart_syscall; |
535 | regs->pc -= 2; | 541 | stepback(regs); |
536 | break; | 542 | break; |
537 | } | 543 | } |
538 | } | 544 | } |