]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Traced negative syscalls should return -ENOSYS
authorJames Hogan <james.hogan@imgtec.com>
Thu, 29 Jun 2017 09:12:36 +0000 (10:12 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 11 Jul 2017 12:13:06 +0000 (14:13 +0200)
commit9eadd34c22478895315d7166ec1bc673526fcd38
treea617cc1577b8824d7c7b9ffd06be40b1f0f6b517
parenta4b6692cac1996b05ba2c1300d99b73fc1ebb4c8
MIPS: Traced negative syscalls should return -ENOSYS

If a negative system call number is used when system call tracing is
enabled, syscall_trace_enter() will return that negative system call
number without having written the return value and error flag into the
pt_regs.

The caller then treats it as a cancelled system call and assumes that
the return value and error flag are already written, leaving the
negative system call number in the return register ($v0), and the 4th
system call argument in the error register ($a3).

Add a special case to detect this at the end of syscall_trace_enter(),
to set the return value to error -ENOSYS when this happens.

Fixes: 20f00212e303 ("MIPS: scall: Always run the seccomp syscall filters")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16653/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/ptrace.c