Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: fix syscall_get_nr

The implementation of syscall_get_nr on mips used to ignore the task
argument and return the syscall number of the calling thread instead of
the target thread.

The bug was exposed to user space by commit 201766a20e30f ("ptrace: add
PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.

Link: https://github.com/strace/strace/issues/235
Fixes: c2d9f1775731 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
Cc: <stable@vger.kernel.org> # v3.19+
Co-developed-by: Dmitry V. Levin <ldv@strace.io>
Signed-off-by: Dmitry V. Levin <ldv@strace.io>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Elvira Khabirova and committed by
Thomas Bogendoerfer
85cc91e2 6f02e39f

+1 -1
+1 -1
arch/mips/include/asm/syscall.h
··· 38 38 static inline long syscall_get_nr(struct task_struct *task, 39 39 struct pt_regs *regs) 40 40 { 41 - return current_thread_info()->syscall; 41 + return task_thread_info(task)->syscall; 42 42 } 43 43 44 44 static inline void mips_syscall_update_nr(struct task_struct *task,