Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 082EA23BD03; Sat, 12 Sep 2026 14:48:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789224529; cv=none; b=Uvilp+MuKfDmzvdzDmnixv7mKcMC6isaeDla5861ATkTJi7SYBLgZWCHCIhEGOW1yWC/8qJ+pK5ceF6r8uDKyYQHa2xJBcJnZO0peF+Cx67Bg9eEBl0kL9EmlOAjlJaxQT5lw+iYOvaTgdA3+NgM1LEexVYZ/KClNAIYoMTiV74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789224529; c=relaxed/simple; bh=C9SCOCXSUWt8oSTGnuYMxdmzSBXZxnzx5IbN8FGcekE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mV9wRXhi5Wi9cQ0lcZPzp4hOYVpShQoXLxg2ELK9WcQuY0V2mYBbn8oHFtIPnNRmJlly3Kn5wrlIsJO20OII/sZDHw3Ui5BTXdmFk1RXSie/g18G9B5RyuVwarp7jMu5ojKueYTrC3ZmZWL1DKXYJU/1plPnknf8OWIJpnHkj1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l+3MudIE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l+3MudIE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D32D51F000FF; Sat, 12 Sep 2026 14:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789224527; bh=854imn4QESJpeo/YXym5/Ypi7YyKdW59JQlOZiYv7f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=l+3MudIE5sFz692vBOtkiIosQCyQ1MbiglkYXml8c9lv6fBAS0iISkhz3oxk90oP4 qKw9FNCcSmSFpD4NR2HDRxVBbqYvF35+x3Cnx7uyNJzh57tWyROh595cbs5FLWlzsG pIUh2bf9ggiJIdIbMv6Lz50KPwoezy/Cr0ZrgaWI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 6.6 1012/1424] MIPS: ptrace: Fix syscall skipping via PTRACE_SYSCALL Date: Sat, 12 Sep 2026 08:57:24 +0200 Message-ID: <20260912065629.974892652@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Bogendoerfer [ Upstream commit 5475c03fa25f31cfd5f8c7e552f8d10347bbaad9 ] 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") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- 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 61503a36067e9..2016dd5e8fae0 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -1319,8 +1319,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; @@ -1356,7 +1360,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.53.0