summaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/signal32.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-11-14 20:32:16 -0800
committerDavid S. Miller <davem@davemloft.net>2011-11-14 20:43:07 -0800
commit1d299bc7732c34d85bd43ac1a8745f5a2fed2078 (patch)
tree6a39fe975dd6c18ab0e5efda38ac0a5c04c62863 /arch/sparc/kernel/signal32.c
parent9ff03b392fa34f6d549fbb56bf05d8a0483aa818 (diff)
downloadtalos-op-linux-1d299bc7732c34d85bd43ac1a8745f5a2fed2078.tar.gz
talos-op-linux-1d299bc7732c34d85bd43ac1a8745f5a2fed2078.zip
sparc: Fix handling of orig_i0 wrt. debugging when restarting syscalls.
Although we provide a proper way for a debugger to control whether syscall restart occurs, we run into problems because orig_i0 is not saved and restored properly. Luckily we can solve this problem without having to make debuggers aware of the issue. Across system calls, several registers are considered volatile and can be safely clobbered. Therefore we use the pt_regs save area of one of those registers, %g2, as a place to save and restore orig_i0. Debuggers transparently will do the right thing because they save and restore this register already. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/signal32.c')
-rw-r--r--arch/sparc/kernel/signal32.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 2caa556db86d..2e86fd1ddc7b 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -822,21 +822,23 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
* want to handle. Thus you cannot kill init even with a SIGKILL even by
* mistake.
*/
-void do_signal32(sigset_t *oldset, struct pt_regs * regs,
- int restart_syscall, unsigned long orig_i0)
+void do_signal32(sigset_t *oldset, struct pt_regs * regs)
{
struct k_sigaction ka;
+ unsigned long orig_i0;
+ int restart_syscall;
siginfo_t info;
int signr;
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
- /* If the debugger messes with the program counter, it clears
- * the "in syscall" bit, directing us to not perform a syscall
- * restart.
- */
- if (restart_syscall && !pt_regs_is_syscall(regs))
- restart_syscall = 0;
+ restart_syscall = 0;
+ orig_i0 = 0;
+ if (pt_regs_is_syscall(regs) &&
+ (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
+ restart_syscall = 1;
+ orig_i0 = regs->u_regs[UREG_G2];
+ }
if (signr > 0) {
if (restart_syscall)
OpenPOWER on IntegriCloud