MIPS: Remove pt_regs adjustments in indirect syscall handler
authorJames Cowgill <James.Cowgill@imgtec.com>
Fri, 31 Mar 2017 16:09:59 +0000 (17:09 +0100)
committerAurelien Jarno <aurel32@debian.org>
Fri, 2 Mar 2018 07:52:22 +0000 (07:52 +0000)
commit9c72dbcd3239ee7449241b72b35fd7a7dda4220a
treeb809af97ae52a553f39b816228751bfe7c028ac2
parentf1e7a6b050083c1d02f10059163a20d0cfa3a78b
MIPS: Remove pt_regs adjustments in indirect syscall handler

If a restartable syscall is called using the indirect o32 syscall
handler - eg: syscall(__NR_waitid, ...), then it is possible for the
incorrect arguments to be passed to the syscall after it has been
restarted. This is because the syscall handler tries to shift all the
registers down one place in pt_regs so that when the syscall is restarted,
the "real" syscall is called instead. Unfortunately it only shifts the
arguments passed in registers, not the arguments on the user stack. This
causes the 4th argument to be duplicated when the syscall is restarted.

Fix by removing all the pt_regs shifting so that the indirect syscall
handler is called again when the syscall is restarted. The comment "some
syscalls like execve get their arguments from struct pt_regs" is long
out of date so this should now be safe.

Signed-off-by: James Cowgill <James.Cowgill@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15856/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Gbp-Pq: Topic bugfix/mips
Gbp-Pq: Name mips-remove-pt_regs-adjustments-in-indirect-syscall-.patch
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-o32.S