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 4DCDCCD37AC for ; Mon, 11 May 2026 09:22:27 +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:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3t2ot8j09mFgea9VNmviu92l2DEgtzfWg+2pijN9X4g=; b=GuMBKWDomNtKkkt++huEALZHQ7 0CtoHYaRQqJSFuoeci8Z5V3CPDOIHHZ89HO76uDfSSVT5gf93xyurWgRFyc9WkIiDgdwUXcV+HVbo wqP1oYLgG5CmKUVH2kI03he2S2v+p7Xtlv1DpQDi53hHhBSP8lOXv30x3RLbrRABZnxUzB8ea2bJE QYF0mIm9T+mVpeRyEGsiITz25KgdBr9db+9nt6I6AICK73TLXnIdAEvo2CQSlfYvIk21UpcayDILW hMIi4H+axNRyznF/cTK/QWMk6Qj1K5aLstF8c2blxosP3u4e9Wx3KORS+FRo0g5e14XqE5+fZYCh1 UWEhKn/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMMqD-0000000CtBH-0rHC; Mon, 11 May 2026 09:22:21 +0000 Received: from canpmsgout01.his.huawei.com ([113.46.200.216]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMMpr-0000000CstS-2NwC for linux-arm-kernel@lists.infradead.org; Mon, 11 May 2026 09:22:10 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=3t2ot8j09mFgea9VNmviu92l2DEgtzfWg+2pijN9X4g=; b=yraL6ssZp2imOPlGy2MCvw0iTVgMOoQ3J5t+JQbZKq511XeQaO5q+858MIqJ1MiHBpUXaeEC6 5Mj+ggaa7VU3AZx5eFqnrA5FdR/sdVhqWARs5xAouHBmZg6CeKc33VDeyNojXNMN6J1M9CyqCMR uj//sGLGpzIo4wKPCvz5Qss= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4gDYvC47Qqz1T4JS; Mon, 11 May 2026 17:14:15 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 1C8904056D; Mon, 11 May 2026 17:21:54 +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; Mon, 11 May 2026 17:21:52 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v15 02/11] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter Date: Mon, 11 May 2026 17:20:54 +0800 Message-ID: <20260511092103.1974980-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260511092103.1974980-1-ruanjinjie@huawei.com> References: <20260511092103.1974980-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.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260511_022200_004556_605FE027 X-CRM114-Status: GOOD ( 10.59 ) 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 Refactor syscall_trace_enter() and syscall_trace_exit() to move thread flag reading to the caller. This aligns arm64's syscall trace enter/exit function signature with generic entry framework. [Changes] 1. Function signature changes: - syscall_trace_enter(regs) → syscall_trace_enter(regs, flags) - syscall_trace_exit(regs) → syscall_trace_exit(regs, flags) 2. Move flags reading to caller: - Previously: read_thread_flags() called inside each function. - Now: caller (like el0_svc_common) passes flags as parameter. 3. Update syscall.c: - el0_svc_common() now passes flags to tracing functions and re-fetches flags before entry/exit to handle potential TIF updates. [Why this matters] - Aligns arm64 with the generic entry interface. - Makes future migration to generic entry framework. No functional changes intended. Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Reviewed-by: Linus Walleij Reviewed-by: Yeoreum Yun Reviewed-by: Kevin Brodsky Signed-off-by: Jinjie Ruan --- arch/arm64/include/asm/syscall.h | 4 ++-- arch/arm64/kernel/ptrace.c | 7 ++----- arch/arm64/kernel/syscall.c | 6 ++++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 5e4c7fc44f73..30b203ef156b 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -120,7 +120,7 @@ static inline int syscall_get_arch(struct task_struct *task) return AUDIT_ARCH_AARCH64; } -int syscall_trace_enter(struct pt_regs *regs); -void syscall_trace_exit(struct pt_regs *regs); +int syscall_trace_enter(struct pt_regs *regs, unsigned long flags); +void syscall_trace_exit(struct pt_regs *regs, unsigned long flags); #endif /* __ASM_SYSCALL_H */ diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index ba5eab23fd90..e4d524ccbc7b 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -2408,9 +2408,8 @@ static void report_syscall_exit(struct pt_regs *regs) } } -int syscall_trace_enter(struct pt_regs *regs) +int syscall_trace_enter(struct pt_regs *regs, unsigned long flags) { - unsigned long flags = read_thread_flags(); int ret; if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) { @@ -2432,10 +2431,8 @@ int syscall_trace_enter(struct pt_regs *regs) return regs->syscallno; } -void syscall_trace_exit(struct pt_regs *regs) +void syscall_trace_exit(struct pt_regs *regs, unsigned long flags) { - unsigned long flags = read_thread_flags(); - audit_syscall_exit(regs); if (flags & _TIF_SYSCALL_TRACEPOINT) diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index 358ddfbf1401..f6f87b042995 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -113,7 +113,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, */ if (scno == NO_SYSCALL) syscall_set_return_value(current, regs, -ENOSYS, 0); - scno = syscall_trace_enter(regs); + flags = read_thread_flags(); + scno = syscall_trace_enter(regs, flags); if (scno == NO_SYSCALL) goto trace_exit; } @@ -132,7 +133,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, } trace_exit: - syscall_trace_exit(regs); + flags = read_thread_flags(); + syscall_trace_exit(regs, flags); } void do_el0_svc(struct pt_regs *regs) -- 2.34.1