]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
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)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 29 Aug 2017 13:48:34 +0000 (15:48 +0200)
commit5af2ed36697e2a48cd7d36232212caa6240fe9bb
tree0d696a9c3f6d55392847992d38bcc60a6f88c57f
parent3d729deaf287c43e415c5d791c9ac8414dbeff70
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>
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-o32.S