Commit 13fdd31a authored by Ralf Baechle's avatar Ralf Baechle

[MIPS] Avoid double signal restarting.

In entry.S resume_userspace ... jal do_notify_resume form a loop through
which the kernel will iterate as long as work is pending.  If we
iterate through this loop more than once with no signal pending for at
least one but the last iteration we will take do the syscall restarting
multiple times resulting in a syscall return prior to the the syscall
instruction in userspace.  This may happen when debugging a multithreaded
program.

Debugging and original fix by Maciej; extended to other ABIs by me.
Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 847b9dfc
...@@ -224,6 +224,7 @@ void do_irix_signal(struct pt_regs *regs) ...@@ -224,6 +224,7 @@ void do_irix_signal(struct pt_regs *regs)
regs->regs[7] = regs->regs[26]; regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4; regs->cp0_epc -= 4;
} }
regs->regs[0] = 0; /* Don't deal with this again. */
} }
/* /*
......
...@@ -429,7 +429,6 @@ void do_signal(struct pt_regs *regs) ...@@ -429,7 +429,6 @@ void do_signal(struct pt_regs *regs)
else else
oldset = &current->blocked; oldset = &current->blocked;
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. */
...@@ -464,6 +463,7 @@ void do_signal(struct pt_regs *regs) ...@@ -464,6 +463,7 @@ void do_signal(struct pt_regs *regs)
regs->regs[7] = regs->regs[26]; regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4; regs->cp0_epc -= 4;
} }
regs->regs[0] = 0; /* Don't deal with this again. */
} }
/* /*
......
...@@ -854,6 +854,7 @@ void do_signal32(struct pt_regs *regs) ...@@ -854,6 +854,7 @@ void do_signal32(struct pt_regs *regs)
regs->regs[7] = regs->regs[26]; regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4; regs->cp0_epc -= 4;
} }
regs->regs[0] = 0; /* Don't deal with this again. */
} }
/* /*
......
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