[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176981000740.2495410.9749775703469431126.tip-bot2@tip-bot2>
Date: Fri, 30 Jan 2026 21:53:27 -0000
From: "tip-bot2 for Jinjie Ruan" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Mark Rutland <mark.rutland@....com>, Thomas Gleixner <tglx@...utronix.de>,
Jinjie Ruan <ruanjinjie@...wei.com>, Thomas Gleixner <tglx@...nel.org>,
Kevin Brodsky <kevin.brodsky@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: core/entry] entry: Add arch_ptrace_report_syscall_entry/exit()
The following commit has been merged into the core/entry branch of tip:
Commit-ID: 578b21fd3ab2d9901ce40ed802e428a41a40610d
Gitweb: https://git.kernel.org/tip/578b21fd3ab2d9901ce40ed802e428a41a40610d
Author: Jinjie Ruan <ruanjinjie@...wei.com>
AuthorDate: Wed, 28 Jan 2026 11:19:30 +08:00
Committer: Thomas Gleixner <tglx@...nel.org>
CommitterDate: Fri, 30 Jan 2026 15:38:09 +01:00
entry: Add arch_ptrace_report_syscall_entry/exit()
ARM64 requires a architecture specific ptrace wrapper as it needs to save
and restore scratch registers.
Provide arch_ptrace_report_syscall_entry/exit() wrappers which fall back to
ptrace_report_syscall_entry/exit() if the architecture does not provide
them.
No functional change intended.
[ tglx: Massaged changelog and comments ]
Suggested-by: Mark Rutland <mark.rutland@....com>
Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
Signed-off-by: Thomas Gleixner <tglx@...nel.org>
Reviewed-by: Kevin Brodsky <kevin.brodsky@....com>
Link: https://patch.msgid.link/20260128031934.3906955-11-ruanjinjie@huawei.com
---
include/linux/entry-common.h | 36 ++++++++++++++++++++++++++++++++++-
kernel/entry/syscall-common.c | 4 ++--
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 5316004..bea207e 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -45,6 +45,24 @@
SYSCALL_WORK_SYSCALL_EXIT_TRAP | \
ARCH_SYSCALL_WORK_EXIT)
+/**
+ * arch_ptrace_report_syscall_entry - Architecture specific ptrace_report_syscall_entry() wrapper
+ *
+ * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_entry().
+ *
+ * This allows architecture specific ptrace_report_syscall_entry()
+ * implementations. If not defined by the architecture this falls back to
+ * to ptrace_report_syscall_entry().
+ */
+static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs);
+
+#ifndef arch_ptrace_report_syscall_entry
+static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs)
+{
+ return ptrace_report_syscall_entry(regs);
+}
+#endif
+
long syscall_trace_enter(struct pt_regs *regs, unsigned long work);
/**
@@ -113,6 +131,24 @@ static __always_inline long syscall_enter_from_user_mode(struct pt_regs *regs, l
}
/**
+ * arch_ptrace_report_syscall_exit - Architecture specific ptrace_report_syscall_exit()
+ *
+ * This allows architecture specific ptrace_report_syscall_exit()
+ * implementations. If not defined by the architecture this falls back to
+ * to ptrace_report_syscall_exit().
+ */
+static __always_inline void arch_ptrace_report_syscall_exit(struct pt_regs *regs,
+ int step);
+
+#ifndef arch_ptrace_report_syscall_exit
+static __always_inline void arch_ptrace_report_syscall_exit(struct pt_regs *regs,
+ int step)
+{
+ ptrace_report_syscall_exit(regs, step);
+}
+#endif
+
+/**
* syscall_exit_work - Handle work before returning to user mode
* @regs: Pointer to current pt_regs
* @work: Current thread syscall work
diff --git a/kernel/entry/syscall-common.c b/kernel/entry/syscall-common.c
index e6237b5..bb5f61f 100644
--- a/kernel/entry/syscall-common.c
+++ b/kernel/entry/syscall-common.c
@@ -33,7 +33,7 @@ long syscall_trace_enter(struct pt_regs *regs, unsigned long work)
/* Handle ptrace */
if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
- ret = ptrace_report_syscall_entry(regs);
+ ret = arch_ptrace_report_syscall_entry(regs);
if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
return -1L;
}
@@ -99,5 +99,5 @@ void syscall_exit_work(struct pt_regs *regs, unsigned long work)
step = report_single_step(work);
if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
- ptrace_report_syscall_exit(regs, step);
+ arch_ptrace_report_syscall_exit(regs, step);
}
Powered by blists - more mailing lists