]> git.baikalelectronics.ru Git - kernel.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)
commitbc24af3674a9580b4e3c7508b957312c040c92d6
tree0d696a9c3f6d55392847992d38bcc60a6f88c57f
parent3c881182cb8af178cc959592a6f83fe6eb5dc958
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