From: Oleg Nesterov <oleg@redhat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: James Hogan <jhogan@kernel.org>, Kees Cook <kees@kernel.org>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: ptrace: Fix syscall skipping via PTRACE_SYSCALL
Date: Sat, 18 Jul 2026 17:23:22 +0200 [thread overview]
Message-ID: <aluaasodc1tSCxtl@redhat.com> (raw)
In-Reply-To: <20260717112731.59254-1-tsbogend@alpha.franken.de>
I obviously can't ack the mips-specific change, but it looks good to me.
Thomas, thanks again.
Oleg.
On 07/17, 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")
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/kernel/ptrace.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
> index 3f4c94c88124..87102a03b6ea 100644
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -1321,8 +1321,12 @@ long arch_ptrace(struct task_struct *child, long request,
> */
> asmlinkage long syscall_trace_enter(struct pt_regs *regs)
> {
> + long syscall;
> +
> user_exit();
>
> + syscall = current_thread_info()->syscall;
> +
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> if (ptrace_report_syscall_entry(regs))
> return -1;
> @@ -1342,7 +1346,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs)
> * Negative syscall numbers are mistaken for rejected syscalls, but
> * won't have had the return value set appropriately, so we do so now.
> */
> - if (current_thread_info()->syscall < 0)
> + if (syscall < 0)
> syscall_set_return_value(current, regs, -ENOSYS, 0);
> return current_thread_info()->syscall;
> }
> --
> 2.51.0
>
prev parent reply other threads:[~2026-07-18 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:27 [PATCH] MIPS: ptrace: Fix syscall skipping via PTRACE_SYSCALL Thomas Bogendoerfer
2026-07-18 15:23 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aluaasodc1tSCxtl@redhat.com \
--to=oleg@redhat.com \
--cc=jhogan@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.