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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 3C146C43638 for ; Mon, 29 Jun 2026 13:07:27 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gpmlK3spLz2yb9; Mon, 29 Jun 2026 23:07:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738429; cv=none; b=aocdg63PLmAqFkhTjMuMdlhgxtVVHkNqW8SvSI3POa4pjudbToRWbKJ6uYAeusDIuws/g+Y+gRl0abwf+DkHfNg/tAVbAaOqcVLiJtSveT8bovEmtOwQsp9b/4KP6kaFyCpF1zr0VTSV9Ti3ZJGq+puMRev6Nqq3WRm83YdbVtzRGm/RnuGBLxT9T2iEPbTzW30FZL/ErIz7m154S3cy1228E9IJ63pKNIUXAIExslC4ygonu50A/J41Cl003cGrE9NMKEVEbf7P+CpTtj9Id+6v6Yzh+KXKkhiX8T/KhuuKkTuVOwL1qB9I/GMRPBuGAo6aaVLE2wKXm4xpUQRs/A== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738429; c=relaxed/relaxed; bh=zB/fjC+R3zx/ldZ3/8oK2r3J7YfHaNZdfYESXvKwXnU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GJrJ3YWcLqQd3yJJhqV46HK89b91ZM1uTDn/BMeHu5D2sSvphgZdpvh1wI36S2hNeq8fDhm14TGjHoVMaCaR4+4gb/6gt21yN5XzdbXUEsI0RRIzzc5bgtU8gp7/8Wi9NIgVf1KTu2GGNrPrUaRKknpQs6IWQa2ADRCNyoAnVPqTe6flyjZoHsIO9u7aWdzml2gmgMsb1wlg9CAybbj9ouVIf7vIUVTq17s7fOr+XzzTrNgIHQiGZymUDW0B2SNG/XWzCK4omrn+IV0RU3H1f0uTGjQsowyyZpwZy8RRpTgQdTKY1BJ+O4/q4QqnErc1LhMO7XvVeBni1BIQf5u1zg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=mOwRVIyy; dkim-atps=neutral; spf=pass (client-ip=113.46.200.216; helo=canpmsgout01.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=mOwRVIyy; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.216; helo=canpmsgout01.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gpmlJ4SYLz2yT0 for ; Mon, 29 Jun 2026 23:07:08 +1000 (AEST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=zB/fjC+R3zx/ldZ3/8oK2r3J7YfHaNZdfYESXvKwXnU=; b=mOwRVIyyI/7ex7M9RN2nxK6PhHDJKnL312ejLMNXz3H5JVPa/94rnk+sVWVAhuNE3JnvDOXGE pHZKqjVCu39RDW0QKSS6YMVQsbxm9X2wtshznqfSlm5NDpCJb6vWtPLNU2SPyst4JYsgOGt/jQ4 FsYIBCz6KTKVIv7LXsrRdrY= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4gpmY34Hqnz1T4gS; Mon, 29 Jun 2026 20:58:15 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id B4F2C4058F; Mon, 29 Jun 2026 21:07:03 +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, 29 Jun 2026 21:06:59 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 06/18] arm64: ptrace: Use syscall_get_arguments() helper for audit Date: Mon, 29 Jun 2026 21:06:04 +0800 Message-ID: <20260629130616.642022-7-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260629130616.642022-1-ruanjinjie@huawei.com> References: <20260629130616.642022-1-ruanjinjie@huawei.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To dggpemf500011.china.huawei.com (7.185.36.131) Extract syscall_enter_audit() helper and use syscall_get_arguments() to get syscall arguments, matching the generic entry implementation. The new code: - Checks audit_context() first to avoid unnecessary memcpy when audit is not active. - Uses syscall_get_arguments() helper instead of directly accessing regs fields. - Is now exactly equivalent to generic entry's syscall_enter_audit(). No functional changes. Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Reviewed-by: Ada Couprie Diaz Reviewed-by: Linus Walleij Reviewed-by: Yeoreum Yun Reviewed-by: Kevin Brodsky Signed-off-by: Jinjie Ruan --- arch/arm64/kernel/ptrace.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 30df515528e8..ae71cadbd4df 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -2408,6 +2408,16 @@ static void report_syscall_exit(struct pt_regs *regs) } } +static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) +{ + if (unlikely(audit_context())) { + unsigned long args[6]; + + syscall_get_arguments(current, regs, args); + audit_syscall_entry(syscall, args[0], args[1], args[2], args[3]); + } +} + int syscall_trace_enter(struct pt_regs *regs, unsigned long flags) { long syscall; @@ -2438,8 +2448,7 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags) syscall = syscall_get_nr(current, regs); } - audit_syscall_entry(syscall, regs->orig_x0, regs->regs[1], - regs->regs[2], regs->regs[3]); + syscall_enter_audit(regs, syscall); return syscall; } -- 2.34.1