[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206101744.4161990-20-ruanjinjie@huawei.com>
Date: Fri, 6 Dec 2024 18:17:41 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <oleg@...hat.com>,
<sstabellini@...nel.org>, <tglx@...utronix.de>, <peterz@...radead.org>,
<luto@...nel.org>, <mingo@...hat.com>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <kees@...nel.org>, <wad@...omium.org>,
<akpm@...ux-foundation.org>, <samitolvanen@...gle.com>,
<masahiroy@...nel.org>, <hca@...ux.ibm.com>, <aliceryhl@...gle.com>,
<rppt@...nel.org>, <xur@...gle.com>, <paulmck@...nel.org>, <arnd@...db.de>,
<mbenes@...e.cz>, <puranjay@...nel.org>, <mark.rutland@....com>,
<ruanjinjie@...wei.com>, <pcc@...gle.com>, <ardb@...nel.org>,
<sudeep.holla@....com>, <guohanjun@...wei.com>, <rafael@...nel.org>,
<liuwei09@...tc.cn>, <dwmw@...zon.co.uk>, <Jonathan.Cameron@...wei.com>,
<liaochang1@...wei.com>, <kristina.martsenko@....com>, <ptosi@...gle.com>,
<broonie@...nel.org>, <thiago.bauermann@...aro.org>, <kevin.brodsky@....com>,
<joey.gouly@....com>, <liuyuntao12@...wei.com>, <leobras@...hat.com>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<xen-devel@...ts.xenproject.org>
Subject: [PATCH -next v5 19/22] arm64/ptrace: Use syscall_get_arguments() heleper
The generic entry check audit context first and use
syscall_get_arguments() helper.
In order to switch to the generic entry for arm64,
- Also use the helper.
- Extract the syscall_enter_audit() helper to make it clear.
- Check audit context for syscall_enter_audit(), which only adds
one additional check without any other differences as
audit_syscall_entry() check it first otherwise do nothing.
No functional changes.
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
arch/arm64/kernel/ptrace.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index c0c00e173f61..3a7a1eaca0a9 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2357,6 +2357,17 @@ 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, long syscall, unsigned long flags)
{
int ret;
@@ -2387,8 +2398,7 @@ int syscall_trace_enter(struct pt_regs *regs, long syscall, 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 regs->syscallno;
}
--
2.34.1
Powered by blists - more mailing lists