linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: fix syscall_get_nr
@ 2023-02-18 22:43 Elvira Khabirova
  2023-02-19  8:30 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Elvira Khabirova @ 2023-02-18 22:43 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Dmitry V. Levin, linux-mips, linux-kernel, stable, Ralf Baechle,
	Paul Burton, James Hogan, Andreas Henriksson

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>
---
 arch/mips/include/asm/syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 25fa651c937d..ebdf4d910af2 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -38,7 +38,7 @@ static inline bool mips_syscall_is_indirect(struct task_struct *task,
 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 void mips_syscall_update_nr(struct task_struct *task,
-- 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mips: fix syscall_get_nr
  2023-02-18 22:43 [PATCH] mips: fix syscall_get_nr Elvira Khabirova
@ 2023-02-19  8:30 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2023-02-19  8:30 UTC (permalink / raw)
  To: Elvira Khabirova
  Cc: Dmitry V. Levin, linux-mips, linux-kernel, stable, Ralf Baechle,
	Paul Burton, James Hogan, Andreas Henriksson

On Sat, Feb 18, 2023 at 11:43:59PM +0100, Elvira Khabirova wrote:
> 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>
> ---
>  arch/mips/include/asm/syscall.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
> index 25fa651c937d..ebdf4d910af2 100644
> --- a/arch/mips/include/asm/syscall.h
> +++ b/arch/mips/include/asm/syscall.h
> @@ -38,7 +38,7 @@ static inline bool mips_syscall_is_indirect(struct task_struct *task,
>  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 void mips_syscall_update_nr(struct task_struct *task,
> -- 

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-19  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-18 22:43 [PATCH] mips: fix syscall_get_nr Elvira Khabirova
2023-02-19  8:30 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).