From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26726C7EE23 for ; Sun, 26 Feb 2023 15:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbjBZPG1 (ORCPT ); Sun, 26 Feb 2023 10:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbjBZPEt (ORCPT ); Sun, 26 Feb 2023 10:04:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B68C293D6; Sun, 26 Feb 2023 06:55:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A390B80C75; Sun, 26 Feb 2023 14:53:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35C2BC433D2; Sun, 26 Feb 2023 14:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677423201; bh=LyJJ4wVn9AuHhKbPdsf7LLzV4TZz8LkznaCsf2AXnNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g8BhtJ9sBMyhO3nwOOFMu+gm8GOCo5xXz+XpMZQz4TNWVvXassGIWLtuqllf71E5O dsKS8j7nkWRjr1d8KqwqLBNyt74oIIuYOb+HetpvRMN5UQINTHS2G5MxmD3QRC51BH m3StKaqm1Stx73E9qdVs9uXfuXjeUZZ0Gq68yidKkZsWOR29H/6WC9oaMXEYfQKbHC nudkVOzhC1j5bKerOPVpRqULC5KGzG9rSzNkFBe2fpkhj76RJR1KiYOn5I0846RLOg 3RVTwoSN2l/0W5VaXvKHL2TX02J284QfuXjIouv5YBGS2l/W6hjivfGtiDrg4Y8d6W okys0ZHgsunYw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Schmitz , Geert Uytterhoeven , Sasha Levin , gerg@linux-m68k.org, ebiederm@xmission.com, linux-m68k@lists.linux-m68k.org Subject: [PATCH AUTOSEL 4.14 10/11] m68k: Check syscall_trace_enter() return code Date: Sun, 26 Feb 2023 09:52:52 -0500 Message-Id: <20230226145255.829660-10-sashal@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230226145255.829660-1-sashal@kernel.org> References: <20230226145255.829660-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Schmitz [ Upstream commit 2ca8a1de4437f21562e57f9ac123914747a8e7a1 ] Check return code of syscall_trace_enter(), and skip syscall if -1. Return code will be left at what had been set by ptrace or seccomp (in regs->d0). No regression seen in testing with strace on ARAnyM. Signed-off-by: Michael Schmitz Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20230112035529.13521-2-schmitzmic@gmail.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/68000/entry.S | 2 ++ arch/m68k/coldfire/entry.S | 2 ++ arch/m68k/kernel/entry.S | 3 +++ 3 files changed, 7 insertions(+) diff --git a/arch/m68k/68000/entry.S b/arch/m68k/68000/entry.S index 259b3661b6141..94abf3d8afc52 100644 --- a/arch/m68k/68000/entry.S +++ b/arch/m68k/68000/entry.S @@ -47,6 +47,8 @@ do_trace: jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + addql #1,%d0 + jeq ret_from_exception movel %sp@(PT_OFF_ORIG_D0),%d1 movel #-ENOSYS,%d0 cmpl #NR_syscalls,%d1 diff --git a/arch/m68k/coldfire/entry.S b/arch/m68k/coldfire/entry.S index 52d312d5b4d4f..fb3b065677459 100644 --- a/arch/m68k/coldfire/entry.S +++ b/arch/m68k/coldfire/entry.S @@ -92,6 +92,8 @@ ENTRY(system_call) jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + addql #1,%d0 + jeq ret_from_exception movel %d3,%a0 jbsr %a0@ movel %d0,%sp@(PT_OFF_D0) /* save the return value */ diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 97cd3ea5f10b8..9a66657773beb 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S @@ -160,9 +160,12 @@ do_trace_entry: jbsr syscall_trace RESTORE_SWITCH_STACK addql #4,%sp + addql #1,%d0 | optimization for cmpil #-1,%d0 + jeq ret_from_syscall movel %sp@(PT_OFF_ORIG_D0),%d0 cmpl #NR_syscalls,%d0 jcs syscall + jra ret_from_syscall badsys: movel #-ENOSYS,%sp@(PT_OFF_D0) jra ret_from_syscall -- 2.39.0