Re: [PATCH -next v4 17/19] entry: Add syscall arch functions to use generic syscall for arm64
From: Thomas Gleixner
Date: Mon Oct 28 2024 - 14:21:29 EST
On Fri, Oct 25 2024 at 18:06, Jinjie Ruan wrote:
$Subject: Can you please make this simply:
entry: Add arch_pre/post_report_syscall_entry/exit()
> Add some syscall arch functions to support arm64 to use generic syscall
> code, which do not affect existing architectures that use generic entry:
>
> - arch_pre/post_report_syscall_entry/exit().
> Also make syscall_exit_work() not static and move report_single_step() to
> thread_info.h, which can be used by arm64 later.
This does way too many things which have nothing to do with the subject
line.
> long syscall_trace_enter(struct pt_regs *regs, long syscall,
> unsigned long work)
> {
> @@ -34,7 +77,9 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall,
>
> /* Handle ptrace */
> if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
> + unsigned long saved_reg = arch_pre_report_syscall_entry(regs);
Lacks a new line between declaration and code.
> ret = ptrace_report_syscall_entry(regs);
> + arch_post_report_syscall_entry(regs, saved_reg, ret);
Though I'm not sure whether these pre/post hooks buy anything. It's
probably simpler to do:
- ret = ptrace_report_syscall_entry(regs);
+ ret = arch_ptrace_report_syscall_entry(regs);
And have the default implementation as
return ptrace_report_syscall_entry(regs);
and let ARM64 implement it's magic around it in the architecture
header. The actual ptrace_report_syscall_entry() is simple enough to be
in both places. That reduces the inflation of architecture specific
helpers and keeps the code tidy.
Thanks,
tglx