Re: [PATCH] MIPS: scall: Save thread_info.syscall unconditionally on entry

From: Thomas Bogendoerfer
Date: Tue Apr 09 2024 - 11:29:29 EST


On Thu, Mar 28, 2024 at 02:27:56PM +0000, Jiaxun Yang wrote:
> thread_info.syscall is used by syscall_get_nr to supply syscall nr
> over a thread stack frame.
>
> Previously, thread_info.syscall is only saved at syscall_trace_enter
> when syscall tracing is enabled. However rest of the kernel code do
> expect syscall_get_nr to be available without syscall tracing. The
> previous design breaks collect_syscall.
>
> Move saving process to syscall entry to fix it.
>
> Reported-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
> Link: https://github.com/util-linux/util-linux/issues/2867
> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> ---
> arch/mips/include/asm/ptrace.h | 2 +-
> arch/mips/kernel/asm-offsets.c | 1 +
> arch/mips/kernel/ptrace.c | 15 ++++++---------
> arch/mips/kernel/scall32-o32.S | 23 +++++++++++++----------
> arch/mips/kernel/scall64-n32.S | 3 ++-
> arch/mips/kernel/scall64-n64.S | 3 ++-
> arch/mips/kernel/scall64-o32.S | 33 +++++++++++++++++----------------
> 7 files changed, 42 insertions(+), 38 deletions(-)

applied to mips-fixes.

Thomas.

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