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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2DE7EE8782F for ; Tue, 3 Feb 2026 13:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eKTeLY9f0IKkgBW1AFClGkUgEuQDZUiFeow1u5ltZ78=; b=URD5y32i8vVmbElvENOpcWX5Lb bWMEhwm4QJgme873VZF+xShdp8yI+rDd2Z2ckgO/Xxb58l3X7Y7HPIYsq/z/jCSbV6B3+p6tVGVRe a4DrJX+9QiowY6Yo6MZGB++FIfK46HMO10uYH7vFWuGD6FMHpq5WZ4GY4vtiiIehIqGtR7g9hoYeF Ss8dpBZc0oY7t5NW7hZgl5JYnNmWtDF5js5DxizpcYt7d2pMW4BkkiBISmNtZ+qr3GLsD0cs/Uhp/ /4x9rja6k7NHQMsjkImufKinq60uOtS3Hj9vKJoHgEdSs/5I+pGOwpq79tXnp/HQYus2fm1BxHnyA J+QOVgpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vnGas-00000006g69-1Pm6; Tue, 03 Feb 2026 13:37:26 +0000 Received: from canpmsgout04.his.huawei.com ([113.46.200.219]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vnGao-00000006fzB-3RJT for linux-arm-kernel@lists.infradead.org; Tue, 03 Feb 2026 13:37:24 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=eKTeLY9f0IKkgBW1AFClGkUgEuQDZUiFeow1u5ltZ78=; b=Wn/6CpTnR2135bQmt7Aj1Zq+tNyfbUAzxE/bheeZE2qoJdhAMq1EfkVsM31IHZIJ2C8WTNRim 7UTBjInNCs/m1KfDHKM5RUQBeeH88iNB0OExPl9L59nQjjXtLVdCRC9FAXoloc7m7QBJGyax1pm d/1aoq0joUU65BtYNU9B1Io= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4f54FP6nT8z1prLM; Tue, 3 Feb 2026 21:33:45 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 74A5B40538; Tue, 3 Feb 2026 21:37:19 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 3 Feb 2026 21:37:17 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v12 09/13] arm64/ptrace: Not check _TIF_SECCOMP/SYSCALL_EMU for syscall_exit_work() Date: Tue, 3 Feb 2026 21:37:24 +0800 Message-ID: <20260203133728.848283-10-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260203133728.848283-1-ruanjinjie@huawei.com> References: <20260203133728.848283-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To dggpemf500011.china.huawei.com (7.185.36.131) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260203_053723_223278_F677F84A X-CRM114-Status: GOOD ( 15.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As syscall_exit_work() do not handle seccomp, so not check _TIF_SECCOMP for syscall_exit_work(). And as the man manual of PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP said, "For PTRACE_SYSEMU, continue and stop on entry to the next system call, which will not be executed. For PTRACE_SYSEMU_SINGLESTEP, do the same but also singlestep if not a system call.". So only the syscall entry need to be reported for SYSCALL_EMU, so not check _TIF_SYSCALL_EMU for syscall_exit_work(). After this, audit_syscall_exit() and report_syscall_exit() will no longer be called if only SECCOMP and/or SYSCALL_EMU is set. And remove has_syscall_work() by the way as currently it is only used in el0_svc_common(). This is another preparation for moving arm64 over to the generic entry code. Link:https://man7.org/linux/man-pages/man2/ptrace.2.html Signed-off-by: Jinjie Ruan --- arch/arm64/include/asm/syscall.h | 5 ----- arch/arm64/include/asm/thread_info.h | 3 +++ arch/arm64/kernel/ptrace.c | 2 +- arch/arm64/kernel/syscall.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index bee5208c0006..85ed31dfe293 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -114,11 +114,6 @@ static inline int syscall_get_arch(struct task_struct *task) return AUDIT_ARCH_AARCH64; } -static inline bool has_syscall_work(unsigned long flags) -{ - return unlikely(flags & _TIF_SYSCALL_WORK); -} - int syscall_trace_enter(struct pt_regs *regs, unsigned long flags); void syscall_exit_to_user_mode_work(struct pt_regs *regs); diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 24fcd6adaa33..ef1462b9b00b 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -110,6 +110,9 @@ void arch_setup_new_exec(void); _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ _TIF_SYSCALL_EMU) +#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_TRACEPOINT) + #ifdef CONFIG_SHADOW_CALL_STACK #define INIT_SCS \ .scs_base = init_shadow_call_stack, \ diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 499ee0a5b9cd..e68aa386ea48 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -2470,7 +2470,7 @@ void syscall_exit_to_user_mode_work(struct pt_regs *regs) rseq_syscall(regs); - if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) + if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP) syscall_exit_work(regs, flags); } diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index 66d4da641d97..ec478fc37a9f 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -101,7 +101,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, return; } - if (has_syscall_work(flags)) { + if (unlikely(flags & _TIF_SYSCALL_WORK)) { /* * The de-facto standard way to skip a system call using ptrace * is to set the system call to -1 (NO_SYSCALL) and set x0 to a -- 2.34.1