Commit 3aeb884b authored by Paul Mundt's avatar Paul Mundt

sh: Handle -ERESTART_RESTARTBLOCK for restartable syscalls.

The current implementation only handles -ERESTARTNOHAND, whereas we
also need to handle -ERESTART_RESTARTBLOCK in the handle_signal()
case for restartable system calls.

As noted by Carl:

This fixes the LTP test nanosleep03 - the current kernel causes
-ERESTART_RESTARTBLOCK to reach user space rather than the correct
-EINTR.
Reported-by: default avatarCarl Shaw <shaw.carl@gmail.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 55273982
...@@ -268,7 +268,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, ...@@ -268,7 +268,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
badframe: badframe:
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
return 0; return 0;
} }
/* /*
* Set up a signal frame. * Set up a signal frame.
...@@ -489,6 +489,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -489,6 +489,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
if (regs->tra >= 0) { if (regs->tra >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
switch (regs->regs[0]) { switch (regs->regs[0]) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
regs->regs[0] = -EINTR; regs->regs[0] = -EINTR;
break; break;
...@@ -584,8 +585,8 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) ...@@ -584,8 +585,8 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
signr = get_signal_to_deliver(&info, &ka, regs, NULL); signr = get_signal_to_deliver(&info, &ka, regs, NULL);
if (signr > 0) { if (signr > 0) {
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
if (handle_signal(signr, &ka, &info, oldset, regs, save_r0) if (handle_signal(signr, &ka, &info, oldset,
== 0) { regs, save_r0) == 0) {
/* a signal was successfully delivered; the saved /* a signal was successfully delivered; the saved
* sigmask will have been stored in the signal frame, * sigmask will have been stored in the signal frame,
* and will be restored by sigreturn, so we can simply * and will be restored by sigreturn, so we can simply
......
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