MIPS: Fix restart of indirect syscalls
authorEd Swierk <eswierk@skyportsystems.com>
Tue, 13 Jan 2015 05:10:30 +0000 (21:10 -0800)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 15 Jan 2015 23:35:45 +0000 (00:35 +0100)
commite967ef022e00bb7c2e5b1a42007abfdd52055050
tree45fa2dc40061ba9e77af3fd2b7ec8fe074bf7f7d
parentfd75a33e0002d2f850c67c775df47c4d479c20c1
MIPS: Fix restart of indirect syscalls

When 32-bit MIPS userspace invokes a syscall indirectly via syscall(number,
arg1, ..., arg7), the kernel looks up the actual syscall based on the given
number, shifts the other arguments to the left, and jumps to the syscall.

If the syscall is interrupted by a signal and indicates it needs to be
restarted by the kernel (by returning ERESTARTNOINTR for example), the
syscall must be called directly, since the number is no longer the first
argument, and the other arguments are now staged for a direct call.

Before shifting the arguments, store the syscall number in pt_regs->regs[2].
This gets copied temporarily into pt_regs->regs[0] after the syscall returns.
If the syscall needs to be restarted, handle_signal()/do_signal() copies the
number back to pt_regs->reg[2], which ends up in $v0 once control returns to
userspace.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8929/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-o32.S
This page took 0.026145 seconds and 5 git commands to generate.