Re: [patch 2/4] entry: Rework trace_syscall_enter()
Radu Rendec <[email protected]> Tue, 14 Jul 2026 11:28:39 -0400
| Newsgroups | dev.linux.lists.loongarch,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2026-07-12 at 23:25 +0200, Thomas Gleixner wrote: > Reread the syscall number from pt_regs and stop returning the eventually > modified syscall number. > > That moves the reread to the end of the syscall_trace_enter() and prepares > for moving it to the call site. > > No functional change. > > Signed-off-by: Thomas Gleixner <[email protected]> > --- > include/linux/entry-common.h | 10 ++++------ > kernel/entry/syscall-common.c | 9 ++------- > 2 files changed, 6 insertions(+), 13 deletions(-) > > --- a/include/linux/entry-common.h > +++ b/include/linux/entry-common.h > @@ -58,7 +58,7 @@ static __always_inline bool arch_ptrace_ > } > #endif > > -long trace_syscall_enter(struct pt_regs *regs, long syscall); > +void trace_syscall_enter(struct pt_regs *regs); > void trace_syscall_exit(struct pt_regs *regs, long ret); > void syscall_enter_audit(struct pt_regs *regs); > > @@ -96,16 +96,14 @@ static __always_inline long syscall_trac > return -1L; > } > > - /* Either of the above might have changed the syscall number */ > - syscall = syscall_get_nr(current, regs); > - > if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT)) > - syscall = trace_syscall_enter(regs, syscall); > + trace_syscall_enter(regs); > > if (unlikely(audit_context())) > syscall_enter_audit(regs); > > - return syscall; > + /* Either of the above might have changed the syscall number */ nit: "Either" implies two items. I would rephrase it to "Any" to make things clearer. > + return syscall_get_nr(current, regs); > } > > /** > --- a/kernel/entry/syscall-common.c > +++ b/kernel/entry/syscall-common.c > @@ -8,14 +8,9 @@ > > /* Out of line to prevent tracepoint code duplication */ > > -long trace_syscall_enter(struct pt_regs *regs, long syscall) > +void trace_syscall_enter(struct pt_regs *regs) > { > - trace_sys_enter(regs, syscall); > - /* > - * Probes or BPF hooks in the tracepoint may have changed the > - * system call number. Reread it. > - */ > - return syscall_get_nr(current, regs); > + trace_sys_enter(regs, syscall_get_nr(current, regs)); > } > > void trace_syscall_exit(struct pt_regs *regs, long ret) With the above, Reviewed-by: Radu Rendec <[email protected]>