Skip to content

Commit

Permalink
mips: fix syscall_get_nr
Browse files Browse the repository at this point in the history
commit 85cc91e upstream.

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 201766a ("ptrace: add
PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.

Link: strace/strace#235
Fixes: c2d9f17 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit dab227639f13de746fa652b27bfb3e8468fabc3f)
  • Loading branch information
parport0 authored and Saeed Mirzamohammadi committed Apr 19, 2023
1 parent 5516991 commit 5902aab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/mips/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
static inline long syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
{
return current_thread_info()->syscall;
return task_thread_info(task)->syscall;
}

static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
Expand Down

0 comments on commit 5902aab

Please sign in to comment.