Commit 00cbf608 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

mn10300: prevent double syscall restarts

set ->orig_d0 to -1, same as what sigreturn does
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e46924d2
...@@ -432,6 +432,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -432,6 +432,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
return -EFAULT; return -EFAULT;
} }
static inline void stepback(struct pt_regs *regs)
{
regs->pc -= 2;
regs->orig_d0 = -1;
}
/* /*
* handle the actual delivery of a signal to userspace * handle the actual delivery of a signal to userspace
*/ */
...@@ -459,7 +465,7 @@ static int handle_signal(int sig, ...@@ -459,7 +465,7 @@ static int handle_signal(int sig,
/* fallthrough */ /* fallthrough */
case -ERESTARTNOINTR: case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0; regs->d0 = regs->orig_d0;
regs->pc -= 2; stepback(regs);
} }
} }
...@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs) ...@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs)
case -ERESTARTSYS: case -ERESTARTSYS:
case -ERESTARTNOINTR: case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0; regs->d0 = regs->orig_d0;
regs->pc -= 2; stepback(regs);
break; break;
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
regs->d0 = __NR_restart_syscall; regs->d0 = __NR_restart_syscall;
regs->pc -= 2; stepback(regs);
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment