Re: [PATCH] MIPS: ptrace: Fix syscall skipping via PTRACE_SYSCALL
From: Thomas Bogendoerfer
Date: Tue Jul 21 2026 - 11:08:51 EST
On Tue, Jul 21, 2026 at 04:43:40PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Thomas,
>
> +Jiaxun
>
> On 17/7/26 13:27, Thomas Bogendoerfer wrote:
> > If tracer wanted to skip a syscall return value was always
> > overwritten with -ENOSYS. Fix this by checking against original
> > syscall number and only return -ENOSYS, if it is negative.
> >
> > Fixes: b6318a903d06 ("MIPS/ptrace: Pick up ptrace/seccomp changed syscalls")
>
> I think you meant:
>
> Fixes: 4370b673ccf2 ("MIPS: scall: Save thread_info.syscall unconditionally
> on entry")
no it was already broken before that commit.
b6318a903d06 reloads syscall number after tracehook_report_syscall_entry() so
the check for negative syscall is done with the "manipulated" syscall number.
And it the syscall should be skipped that number is -1.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]