* [PATCH v14 00/10] arm64: entry: Convert to Generic Entry
@ 2026-03-20 10:26 Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 01/10] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter Jinjie Ruan
` (10 more replies)
0 siblings, 11 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Currently, x86, Riscv, Loongarch use the Generic Entry which makes
maintainers' work easier and codes more elegant. arm64 has already
successfully switched to the Generic IRQ Entry in commit
b3cf07851b6c ("arm64: entry: Switch to generic IRQ entry"), it is
time to completely convert arm64 to Generic Entry.
The goal is to bring arm64 in line with other architectures that already
use the generic entry infrastructure, reducing duplicated code and
making it easier to share future changes in entry/exit paths, such as
"Syscall User Dispatch" and RSEQ optimizations.
This patch set is rebased on arm64 for-next/core. This series contains
foundational updates for arm64. As suggested by Linus Walleij, these 10
patches are being submitted separately for inclusion in the arm64 tree.
And the performance benchmarks results on qemu-kvm are below:
perf bench syscall usec/op (-ve is improvement)
| Syscall | Base | Generic Entry | change % |
| ------- | ----------- | ------------- | -------- |
| basic | 0.123997 | 0.120872 | -2.57 |
| execve | 512.1173 | 504.9966 | -1.52 |
| fork | 114.1144 | 113.2301 | -1.06 |
| getpgid | 0.120182 | 0.121245 | +0.9 |
perf bench syscall ops/sec (+ve is improvement)
| Syscall | Base | Generic Entry| change % |
| ------- | -------- | ------------ | -------- |
| basic | 8064712 | 8273212 | +2.48 |
| execve | 1952 | 1980 | +1.52 |
| fork | 8763 | 8832 | +1.06 |
| getpgid | 8320704 | 8247810 | -0.9 |
Therefore, the syscall performance variation ranges from a 1% regression
to a 2.5% improvement.
It was tested ok with following test cases on QEMU virt platform:
- Stress-ng CPU stress test.
- Hackbench stress test.
- "sud" selftest testcase.
- get_set_sud, get_syscall_info, set_syscall_info, peeksiginfo
in tools/testing/selftests/ptrace.
- breakpoint_test_arm64 in selftests/breakpoints.
- syscall-abi and ptrace in tools/testing/selftests/arm64/abi
- fp-ptrace, sve-ptrace, za-ptrace in selftests/arm64/fp.
- vdso_test_getrandom in tools/testing/selftests/vDSO
- Strace tests.
- slice_test for rseq optimizations.
The test QEMU configuration is as follows:
qemu-system-aarch64 \
-M virt \
-enable-kvm \
-cpu host \
-kernel Image \
-smp 8 \
-m 512m \
-nographic \
-no-reboot \
-device virtio-rng-pci \
-append "root=/dev/vda rw console=ttyAMA0 kgdboc=ttyAMA0,115200 \
earlycon preempt=voluntary irqchip.gicv3_pseudo_nmi=1 audit=1" \
-drive if=none,file=images/rootfs.ext4,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 \
Changes in v14:
- Initialize ret = 0 in syscall_trace_enter().
- Split into two patch sets as Linus Walleij suggested, so this patch set
can be applied separately to the arm64 tree.
- Rebased on arm64 for-next/core branch.
- Collect Reviewed-by and Acked-by.
- Link to v13 resend: https://lore.kernel.org/all/20260317082020.737779-15-ruanjinjie@huawei.com/
Changes in v13 resend:
- Fix exit_to_user_mode_prepare_legacy() issues.
- Also move TIF_SINGLESTEP to generic TIF infrastructure for loongarch.
- Use generic TIF bits for arm64 and moving TIF_SINGLESTEP to
generic TIF for related architectures separately.
- Refactor syscall_trace_enter/exit() to accept flags and Use
syscall_get_nr() helper separately.
- Tested with slice_test for rseq optimizations.
- Add acked-by.
- Link to v13: https://lore.kernel.org/all/20260313094738.3985794-1-ruanjinjie@huawei.com/
Changes in v13:
- Rebased on v7.0-rc3, so drop the firt applied arm64 patch.
- Use generic TIF bits to enables RSEQ optimization.
- Update most of the commit message to make it more clear.
- Link to v12: https://lore.kernel.org/all/20260203133728.848283-1-ruanjinjie@huawei.com/
Changes in v12:
- Rebased on "sched/core", so remove the four generic entry patches.
- Move "Expand secure_computing() in place" and
"Use syscall_get_arguments() helper" patch forward, which will group all
non-functional cleanups at the front.
- Adjust the explanation for moving rseq_syscall() before
audit_syscall_exit().
- Link to v11: https://lore.kernel.org/all/20260128031934.3906955-1-ruanjinjie@huawei.com/
Changes in v11:
- Remove unused syscall in syscall_trace_enter().
- Update and provide a detailed explanation of the differences after
moving rseq_syscall() before audit_syscall_exit().
- Rebased on arm64 (for-next/entry), and remove the first applied 3 patchs.
- syscall_exit_to_user_mode_work() for arch reuse instead of adding
new syscall_exit_to_user_mode_work_prepare() helper.
- Link to v10: https://lore.kernel.org/all/20251222114737.1334364-1-ruanjinjie@huawei.com/
Changes in v10:
- Rebased on v6.19-rc1, rename syscall_exit_to_user_mode_prepare() to
syscall_exit_to_user_mode_work_prepare() to avoid conflict.
- Also inline syscall_trace_enter().
- Support aarch64 for sud_benchmark.
- Update and correct the commit message.
- Add Reviewed-by.
- Link to v9: https://lore.kernel.org/all/20251204082123.2792067-1-ruanjinjie@huawei.com/
Changes in v9:
- Move "Return early for ptrace_report_syscall_entry() error" patch ahead
to make it not introduce a regression.
- Not check _TIF_SECCOMP/SYSCALL_EMU for syscall_exit_work() in
a separate patch.
- Do not report_syscall_exit() for PTRACE_SYSEMU_SINGLESTEP in a separate
patch.
- Add two performance patch to improve the arm64 performance.
- Add Reviewed-by.
- Link to v8: https://lore.kernel.org/all/20251126071446.3234218-1-ruanjinjie@huawei.com/
Changes in v8:
- Rename "report_syscall_enter()" to "report_syscall_entry()".
- Add ptrace_save_reg() to avoid duplication.
- Remove unused _TIF_WORK_MASK in a standalone patch.
- Align syscall_trace_enter() return value with the generic version.
- Use "scno" instead of regs->syscallno in el0_svc_common().
- Move rseq_syscall() ahead in a standalone patch to clarify it clearly.
- Rename "syscall_trace_exit()" to "syscall_exit_work()".
- Keep the goto in el0_svc_common().
- No argument was passed to __secure_computing() and check -1 not -1L.
- Remove "Add has_syscall_work() helper" patch.
- Move "Add syscall_exit_to_user_mode_prepare() helper" patch later.
- Add miss header for asm/entry-common.h.
- Update the implementation of arch_syscall_is_vdso_sigreturn().
- Add "ARCH_SYSCALL_WORK_EXIT" to be defined as "SECCOMP | SYSCALL_EMU"
to keep the behaviour unchanged.
- Add more testcases test.
- Add Reviewed-by.
- Update the commit message.
- Link to v7: https://lore.kernel.org/all/20251117133048.53182-1-ruanjinjie@huawei.com/
Jinjie Ruan (10):
arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags
parameter
arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter()
arm64/ptrace: Expand secure_computing() in place
arm64/ptrace: Use syscall_get_arguments() helper for audit
arm64: ptrace: Move rseq_syscall() before audit_syscall_exit()
arm64: syscall: Introduce syscall_exit_to_user_mode_work()
arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK
arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP
arm64: entry: Convert to generic entry
arm64: Inline el0_svc_common()
arch/arm64/Kconfig | 2 +-
arch/arm64/include/asm/entry-common.h | 76 +++++++++++++++++
arch/arm64/include/asm/syscall.h | 19 ++++-
arch/arm64/include/asm/thread_info.h | 16 +---
arch/arm64/kernel/debug-monitors.c | 7 ++
arch/arm64/kernel/entry-common.c | 25 ++++--
arch/arm64/kernel/ptrace.c | 115 --------------------------
arch/arm64/kernel/signal.c | 2 +-
arch/arm64/kernel/syscall.c | 29 ++-----
include/linux/irq-entry-common.h | 8 --
include/linux/rseq_entry.h | 18 ----
11 files changed, 130 insertions(+), 187 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v14 01/10] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 02/10] arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter() Jinjie Ruan
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Refactor syscall_trace_enter() and syscall_trace_exit() to move thread
flag reading to the caller. This aligns arm64's syscall trace enter/exit
function signature with generic entry framework.
[Changes]
1. Function signature changes:
- syscall_trace_enter(regs) → syscall_trace_enter(regs, flags)
- syscall_trace_exit(regs) → syscall_trace_exit(regs, flags)
2. Move flags reading to caller:
- Previously: read_thread_flags() called inside each function.
- Now: caller (like el0_svc_common) passes flags as parameter.
3. Update syscall.c:
- el0_svc_common() now passes flags to tracing functions and
re-fetches flags before exit to handle potential TIF updates.
[Why this matters]
- Aligns arm64 with the generic entry interface.
- Makes future migration to generic entry framework.
No functional changes intended.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/include/asm/syscall.h | 4 ++--
arch/arm64/kernel/ptrace.c | 7 ++-----
arch/arm64/kernel/syscall.c | 5 +++--
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 5e4c7fc44f73..30b203ef156b 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -120,7 +120,7 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_AARCH64;
}
-int syscall_trace_enter(struct pt_regs *regs);
-void syscall_trace_exit(struct pt_regs *regs);
+int syscall_trace_enter(struct pt_regs *regs, unsigned long flags);
+void syscall_trace_exit(struct pt_regs *regs, unsigned long flags);
#endif /* __ASM_SYSCALL_H */
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index ba5eab23fd90..e4d524ccbc7b 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2408,9 +2408,8 @@ static void report_syscall_exit(struct pt_regs *regs)
}
}
-int syscall_trace_enter(struct pt_regs *regs)
+int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
{
- unsigned long flags = read_thread_flags();
int ret;
if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
@@ -2432,10 +2431,8 @@ int syscall_trace_enter(struct pt_regs *regs)
return regs->syscallno;
}
-void syscall_trace_exit(struct pt_regs *regs)
+void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
{
- unsigned long flags = read_thread_flags();
-
audit_syscall_exit(regs);
if (flags & _TIF_SYSCALL_TRACEPOINT)
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index c062badd1a56..e8fd0d60ab09 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -124,7 +124,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
*/
if (scno == NO_SYSCALL)
syscall_set_return_value(current, regs, -ENOSYS, 0);
- scno = syscall_trace_enter(regs);
+ scno = syscall_trace_enter(regs, flags);
if (scno == NO_SYSCALL)
goto trace_exit;
}
@@ -143,7 +143,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
}
trace_exit:
- syscall_trace_exit(regs);
+ flags = read_thread_flags();
+ syscall_trace_exit(regs, flags);
}
void do_el0_svc(struct pt_regs *regs)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 02/10] arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter()
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 01/10] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 03/10] arm64/ptrace: Expand secure_computing() in place Jinjie Ruan
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Use syscall_get_nr() to get syscall number for syscall_trace_enter().
This aligns arm64's internal tracing logic with the generic
entry framework.
[Changes]
1. Use syscall_get_nr() helper:
- Replace direct regs->syscallno access with
syscall_get_nr(current, regs).
- This helper is functionally equivalent to direct access on arm64.
2. Re-read syscall number after tracepoint:
- Re-fetch the syscall number after trace_sys_enter() as it may have
been modified by BPF or ftrace probes, matching generic entry behavior.
[Why this matters]
- Aligns arm64 with the generic entry interface.
- Makes future migration to generic entry framework.
- Properly handles syscall number modifications by tracers.
- Uses standard architecture-independent helpers.
No functional changes intended.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/kernel/ptrace.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index e4d524ccbc7b..8d296a07fbf7 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2410,6 +2410,7 @@ static void report_syscall_exit(struct pt_regs *regs)
int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
{
+ long syscall;
int ret;
if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
@@ -2422,13 +2423,23 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
if (secure_computing() == -1)
return NO_SYSCALL;
- if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
- trace_sys_enter(regs, regs->syscallno);
+ /* Either of the above might have changed the syscall number */
+ syscall = syscall_get_nr(current, regs);
- audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
+ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) {
+ trace_sys_enter(regs, syscall);
+
+ /*
+ * Probes or BPF hooks in the tracepoint may have changed the
+ * system call number as well.
+ */
+ syscall = syscall_get_nr(current, regs);
+ }
+
+ audit_syscall_entry(syscall, regs->orig_x0, regs->regs[1],
regs->regs[2], regs->regs[3]);
- return regs->syscallno;
+ return syscall;
}
void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 03/10] arm64/ptrace: Expand secure_computing() in place
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 01/10] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 02/10] arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter() Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 04/10] arm64/ptrace: Use syscall_get_arguments() helper for audit Jinjie Ruan
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Refactor syscall_trace_enter() by open-coding the seccomp check
to align with the generic entry framework.
[Background]
The generic entry implementation expands the seccomp check in-place
instead of using the secure_computing() wrapper. It directly tests
SYSCALL_WORK_SECCOMP and calls the underlying __secure_computing()
function to handle syscall filtering.
[Changes]
1. Open-code seccomp check:
- Instead of calling the secure_computing() wrapper, explicitly check
the 'flags' parameter for _TIF_SECCOMP.
- Call __secure_computing() directly if the flag is set.
2. Refine return value handling:
- Use 'return ret ? : syscall' to propagate the return value.
- Ensures any unexpected non-zero return from __secure_computing()
is properly propagated is properly propagated.
- This matches the logic in the generic entry code.
[Why this matters]
- Aligns the arm64 syscall path with the generic entry implementation,
simplifying future migration to the generic entry framework.
- No functional changes are intended; seccomp behavior remains identical.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/kernel/ptrace.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 8d296a07fbf7..85b597cac14b 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2411,7 +2411,7 @@ static void report_syscall_exit(struct pt_regs *regs)
int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
{
long syscall;
- int ret;
+ int ret = 0;
if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
ret = report_syscall_entry(regs);
@@ -2420,8 +2420,11 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
}
/* Do the secure computing after ptrace; failures should be fast. */
- if (secure_computing() == -1)
- return NO_SYSCALL;
+ if (flags & _TIF_SECCOMP) {
+ ret = __secure_computing();
+ if (ret == -1)
+ return NO_SYSCALL;
+ }
/* Either of the above might have changed the syscall number */
syscall = syscall_get_nr(current, regs);
@@ -2439,7 +2442,7 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
audit_syscall_entry(syscall, regs->orig_x0, regs->regs[1],
regs->regs[2], regs->regs[3]);
- return syscall;
+ return ret ? : syscall;
}
void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 04/10] arm64/ptrace: Use syscall_get_arguments() helper for audit
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (2 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 03/10] arm64/ptrace: Expand secure_computing() in place Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 05/10] arm64: ptrace: Move rseq_syscall() before audit_syscall_exit() Jinjie Ruan
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
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: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
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 85b597cac14b..a908e05749c1 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;
@@ -2439,8 +2449,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 ret ? : syscall;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 05/10] arm64: ptrace: Move rseq_syscall() before audit_syscall_exit()
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (3 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 04/10] arm64/ptrace: Use syscall_get_arguments() helper for audit Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 06/10] arm64: syscall: Introduce syscall_exit_to_user_mode_work() Jinjie Ruan
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Move the rseq_syscall() check earlier in the syscall exit path to ensure
it operates on the original instruction pointer (regs->pc) before any
potential modification by a tracer.
[Background]
When CONFIG_DEBUG_RSEQ is enabled, rseq_syscall() verifies that a system
call was not executed within an rseq critical section by examining
regs->pc. If a violation is detected, it triggers a SIGSEGV.
[Problem]
Currently, arm64 invokes rseq_syscall() after report_syscall_exit().
However, during report_syscall_exit(), a ptrace tracer can modify the
task's instruction pointer via PTRACE_SETREGS. This leads to an
inconsistency where rseq may analyze a post-trace PC instead of the
actual PC at the time of syscall exit.
[Why this matters]
The rseq check is intended to validate the execution context of the
syscall itself. Analyzing a tracer-modified PC can lead to incorrect
detection or missed violations. Moving the check earlier ensures rseq
sees the authentic state of the task.
[Alignment]
This change aligns arm64 with:
- Generic entry, which calls rseq_syscall() first.
- arm32 implementation, which also performs the check before audit.
[Impact]
There is no functional change to signal delivery; SIGSEGV will still be
processed in arm64_exit_to_user_mode() at the end of the exit path.
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/kernel/ptrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index a908e05749c1..8245d1ae61cf 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2456,6 +2456,8 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
{
+ rseq_syscall(regs);
+
audit_syscall_exit(regs);
if (flags & _TIF_SYSCALL_TRACEPOINT)
@@ -2463,8 +2465,6 @@ void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP))
report_syscall_exit(regs);
-
- rseq_syscall(regs);
}
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 06/10] arm64: syscall: Introduce syscall_exit_to_user_mode_work()
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (4 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 05/10] arm64: ptrace: Move rseq_syscall() before audit_syscall_exit() Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 07/10] arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK Jinjie Ruan
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Refactor the system call exit path to align with the generic entry
framework. This consolidates thread flag checking, rseq handling, and
syscall tracing into a structure that mirrors the generic
syscall_exit_to_user_mode_work() implementation.
[Rationale]
The generic entry code employs a hierarchical approach for
syscall exit work:
1. syscall_exit_to_user_mode_work(): The entry point that handles
rseq and checks if further exit work (tracing/audit) is required.
2. syscall_exit_work(): Performs the actual tracing, auditing, and
ptrace reporting.
[Changes]
- Rename and Encapsulate: Rename syscall_trace_exit() to
syscall_exit_work() and make it static, as it is now an internal
helper for the exit path.
- New Entry Point: Implement syscall_exit_to_user_mode_work() to
replace the manual flag-reading logic in el0_svc_common(). This
function now encapsulates the rseq_syscall() call and the
conditional execution of syscall_exit_work().
- Simplify el0_svc_common(): Remove the complex conditional checks
for tracing and CONFIG_DEBUG_RSEQ at the end of the syscall path,
delegating this responsibility to the new helper.
- Helper Migration: Move has_syscall_work() to asm/syscall.h
to allow its reuse across ptrace.c and syscall.c.
- Clean up RSEQ: Remove the explicit IS_ENABLED(CONFIG_DEBUG_RSEQ)
check in the caller, as rseq_syscall() is already a no-op when the
config is disabled.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/include/asm/syscall.h | 7 ++++++-
arch/arm64/kernel/ptrace.c | 14 +++++++++++---
arch/arm64/kernel/syscall.c | 20 +-------------------
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 30b203ef156b..c469d09a7964 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -120,7 +120,12 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_AARCH64;
}
+static inline bool has_syscall_work(unsigned long flags)
+{
+ return unlikely(flags & _TIF_SYSCALL_WORK);
+}
+
int syscall_trace_enter(struct pt_regs *regs, unsigned long flags);
-void syscall_trace_exit(struct pt_regs *regs, unsigned long flags);
+void syscall_exit_to_user_mode_work(struct pt_regs *regs);
#endif /* __ASM_SYSCALL_H */
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 8245d1ae61cf..2c97de8a097c 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2454,10 +2454,8 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
return ret ? : syscall;
}
-void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
+static void syscall_exit_work(struct pt_regs *regs, unsigned long flags)
{
- rseq_syscall(regs);
-
audit_syscall_exit(regs);
if (flags & _TIF_SYSCALL_TRACEPOINT)
@@ -2467,6 +2465,16 @@ void syscall_trace_exit(struct pt_regs *regs, unsigned long flags)
report_syscall_exit(regs);
}
+void syscall_exit_to_user_mode_work(struct pt_regs *regs)
+{
+ unsigned long flags = read_thread_flags();
+
+ rseq_syscall(regs);
+
+ if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP)
+ syscall_exit_work(regs, flags);
+}
+
/*
* SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a.
* We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index e8fd0d60ab09..66d4da641d97 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -65,11 +65,6 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
choose_random_kstack_offset(get_random_u16());
}
-static inline bool has_syscall_work(unsigned long flags)
-{
- return unlikely(flags & _TIF_SYSCALL_WORK);
-}
-
static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
const syscall_fn_t syscall_table[])
{
@@ -130,21 +125,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
}
invoke_syscall(regs, scno, sc_nr, syscall_table);
-
- /*
- * The tracing status may have changed under our feet, so we have to
- * check again. However, if we were tracing entry, then we always trace
- * exit regardless, as the old entry assembly did.
- */
- if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) {
- flags = read_thread_flags();
- if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP))
- return;
- }
-
trace_exit:
- flags = read_thread_flags();
- syscall_trace_exit(regs, flags);
+ syscall_exit_to_user_mode_work(regs);
}
void do_el0_svc(struct pt_regs *regs)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 07/10] arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (5 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 06/10] arm64: syscall: Introduce syscall_exit_to_user_mode_work() Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 08/10] arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP Jinjie Ruan
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Introduce _TIF_SYSCALL_EXIT_WORK to filter out entry-only flags
during the syscall exit path. This aligns arm64 with the generic
entry framework's SYSCALL_WORK_EXIT semantics.
[Rationale]
The current syscall exit path uses _TIF_SYSCALL_WORK to decide whether
to invoke syscall_exit_work(). However, _TIF_SYSCALL_WORK includes
flags that are only relevant during syscall entry:
1. _TIF_SECCOMP: Seccomp filtering (__secure_computing) only runs
on entry. There is no seccomp callback for syscall exit.
2. _TIF_SYSCALL_EMU: In PTRACE_SYSEMU mode, the syscall is
intercepted and skipped on entry. Since the syscall is never
executed, reporting a syscall exit stop is unnecessary.
[Changes]
- Define _TIF_SYSCALL_EXIT_WORK: A new mask containing only flags
requiring exit processing: _TIF_SYSCALL_TRACE, _TIF_SYSCALL_AUDIT,
and _TIF_SYSCALL_TRACEPOINT.
- Update exit path: Use _TIF_SYSCALL_EXIT_WORK in
syscall_exit_to_user_mode_work() to avoid redundant calls to
audit and ptrace reporting when only entry-flags are set.
- Cleanup: Remove the has_syscall_work() helper as it is no longer
needed. Direct flag comparison is now used to distinguish between
entry and exit work requirements.
[Impact]
audit_syscall_exit() and report_syscall_exit() will no longer be
triggered for seccomp-only or emu-only syscalls. This matches the
generic entry behavior and improves efficiency by skipping unnecessary
exit processing.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/include/asm/syscall.h | 5 -----
arch/arm64/include/asm/thread_info.h | 3 +++
arch/arm64/kernel/ptrace.c | 2 +-
arch/arm64/kernel/syscall.c | 2 +-
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index c469d09a7964..dea392c081ca 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -120,11 +120,6 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_AARCH64;
}
-static inline bool has_syscall_work(unsigned long flags)
-{
- return unlikely(flags & _TIF_SYSCALL_WORK);
-}
-
int syscall_trace_enter(struct pt_regs *regs, unsigned long flags);
void syscall_exit_to_user_mode_work(struct pt_regs *regs);
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 7942478e4065..4ae83cb620bb 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -109,6 +109,9 @@ void arch_setup_new_exec(void);
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
_TIF_SYSCALL_EMU)
+#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
+ _TIF_SYSCALL_TRACEPOINT)
+
#ifdef CONFIG_SHADOW_CALL_STACK
#define INIT_SCS \
.scs_base = init_shadow_call_stack, \
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 2c97de8a097c..c494fec68e35 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2471,7 +2471,7 @@ void syscall_exit_to_user_mode_work(struct pt_regs *regs)
rseq_syscall(regs);
- if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP)
+ if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP)
syscall_exit_work(regs, flags);
}
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index 66d4da641d97..ec478fc37a9f 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -101,7 +101,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
return;
}
- if (has_syscall_work(flags)) {
+ if (unlikely(flags & _TIF_SYSCALL_WORK)) {
/*
* The de-facto standard way to skip a system call using ptrace
* is to set the system call to -1 (NO_SYSCALL) and set x0 to a
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 08/10] arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (6 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 07/10] arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 09/10] arm64: entry: Convert to generic entry Jinjie Ruan
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Align the syscall exit reporting logic with the generic entry
framework by skipping the exit stop when PTRACE_SYSEMU_SINGLESTEP is
in effect.
[Rationale]
When a tracer uses PTRACE_SYSEMU_SINGLESTEP, both _TIF_SYSCALL_EMU
and _TIF_SINGLESTEP flags are set. Currently, arm64 reports a syscall
exit stop whenever _TIF_SINGLESTEP is set, regardless of the
emulation state.
However, as per the generic entry implementation (see
include/linux/entry-common.h):
"If SYSCALL_EMU is set, then the only reason to report is when SINGLESTEP
is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall instruction has been
already reported in syscall_trace_enter()."
Since PTRACE_SYSEMU intercepts and skips the actual syscall
execution, reporting a subsequent exit stop is redundant and
inconsistent with the expected behavior of emulated system calls.
[Changes]
- Introduce report_single_step(): Add a helper to encapsulate the
logic for deciding whether to report a single-step stop at syscall
exit. It returns false if _TIF_SYSCALL_EMU is set, ensuring the
emulated syscall does not trigger a duplicate report.
- Update syscall_exit_work(): Use the new helper to determine
the stepping state instead of directly checking _TIF_SINGLESTEP.
[Impact]
- PTRACE_SINGLESTEP: Continues to report exit stops for actual
instructions.
- PTRACE_SYSEMU: Continues to skip exit stops.
- PTRACE_SYSEMU_SINGLESTEP: Now correctly skips the redundant exit
stop, aligning arm64 with the generic entry infrastructure.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/kernel/ptrace.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index c494fec68e35..e3b74add88e7 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2454,14 +2454,25 @@ int syscall_trace_enter(struct pt_regs *regs, unsigned long flags)
return ret ? : syscall;
}
+static inline bool report_single_step(unsigned long flags)
+{
+ if (flags & _TIF_SYSCALL_EMU)
+ return false;
+
+ return flags & _TIF_SINGLESTEP;
+}
+
static void syscall_exit_work(struct pt_regs *regs, unsigned long flags)
{
+ bool step;
+
audit_syscall_exit(regs);
if (flags & _TIF_SYSCALL_TRACEPOINT)
trace_sys_exit(regs, syscall_get_return_value(current, regs));
- if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP))
+ step = report_single_step(flags);
+ if (step || flags & _TIF_SYSCALL_TRACE)
report_syscall_exit(regs);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 09/10] arm64: entry: Convert to generic entry
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (7 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 08/10] arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 10/10] arm64: Inline el0_svc_common() Jinjie Ruan
2026-04-09 6:29 ` [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
Implement the generic entry framework for arm64 to handle system call
entry and exit. This follows the migration of x86, RISC-V, and LoongArch,
consolidating architecture-specific syscall tracing and auditing into
the common kernel entry infrastructure.
[Background]
Arm64 has already adopted generic IRQ entry. Completing the conversion
to the generic syscall entry framework reduces architectural divergence,
simplifies maintenance, and allows arm64 to automatically benefit from
improvements in the common entry code.
[Changes]
1. Kconfig and Infrastructure:
- Select GENERIC_ENTRY and remove GENERIC_IRQ_ENTRY (now implied).
- Migrate struct thread_info to use the syscall_work field instead
of TIF flags for syscall-related tasks.
2. Thread Info and Flags:
- Remove definitions for TIF_SYSCALL_TRACE, TIF_SYSCALL_AUDIT,
TIF_SYSCALL_TRACEPOINT, TIF_SECCOMP, and TIF_SYSCALL_EMU.
- Replace _TIF_SYSCALL_WORK and _TIF_SYSCALL_EXIT_WORK with the
generic SYSCALL_WORK bitmask.
- Map single-step state to SYSCALL_EXIT_TRAP in debug-monitors.c.
3. Architecture-Specific Hooks (asm/entry-common.h):
- Implement arch_ptrace_report_syscall_entry() and _exit() by
porting the existing arm64 logic to the generic interface.
- Add arch_syscall_is_vdso_sigreturn() to asm/syscall.h to
support Syscall User Dispatch (SUD).
4. Differentiate between syscall and interrupt entry/exit paths to handle
RSEQ slice extensions correctly.
- For irq/exception entry/exit: use irqentry_enter_from_user_mode() and
irqentry_exit_to_user_mode_prepare().
- For syscall entry/exit: use enter_from_user_mode() and
syscall_exit_to_user_mode_prepare().
- Remove exit_to_user_mode_prepare_legacy() which is no longer necessary.
5. Cleanup and Refactoring:
- Remove redundant arm64-specific syscall tracing functions from
ptrace.c, including syscall_trace_enter(), syscall_exit_work(),
and related audit/step helpers.
- Update el0_svc_common() in syscall.c to use the generic
syscall_work checks and entry/exit call sites.
[Why this matters]
- Unified Interface: Aligns arm64 with the modern kernel entry standard.
- Improved Maintainability: Bug fixes in kernel/entry/common.c now
apply to arm64 automatically.
- Feature Readiness: Simplifies the implementation of future
cross-architecture syscall features.
[Compatibility]
This conversion maintains full ABI compatibility with existing
userspace. The ptrace register-saving behavior, seccomp filtering, and
syscall tracing semantics remain identical to the previous implementation.
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Suggested-by: Kevin Brodsky <kevin.brodsky@arm.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/Kconfig | 2 +-
arch/arm64/include/asm/entry-common.h | 76 +++++++++++++
arch/arm64/include/asm/syscall.h | 19 +++-
arch/arm64/include/asm/thread_info.h | 19 +---
arch/arm64/kernel/debug-monitors.c | 7 ++
arch/arm64/kernel/entry-common.c | 25 ++++-
arch/arm64/kernel/ptrace.c | 154 --------------------------
arch/arm64/kernel/signal.c | 2 +-
arch/arm64/kernel/syscall.c | 6 +-
include/linux/irq-entry-common.h | 8 --
include/linux/rseq_entry.h | 18 ---
11 files changed, 127 insertions(+), 209 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 38dba5f7e4d2..96fef01598be 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -154,9 +154,9 @@ config ARM64
select GENERIC_CPU_DEVICES
select GENERIC_CPU_VULNERABILITIES
select GENERIC_EARLY_IOREMAP
+ select GENERIC_ENTRY
select GENERIC_IDLE_POLL_SETUP
select GENERIC_IOREMAP
- select GENERIC_IRQ_ENTRY
select GENERIC_IRQ_IPI
select GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD
select GENERIC_IRQ_PROBE
diff --git a/arch/arm64/include/asm/entry-common.h b/arch/arm64/include/asm/entry-common.h
index cab8cd78f693..d8bf4bf342e8 100644
--- a/arch/arm64/include/asm/entry-common.h
+++ b/arch/arm64/include/asm/entry-common.h
@@ -3,14 +3,21 @@
#ifndef _ASM_ARM64_ENTRY_COMMON_H
#define _ASM_ARM64_ENTRY_COMMON_H
+#include <linux/ptrace.h>
#include <linux/thread_info.h>
+#include <asm/compat.h>
#include <asm/cpufeature.h>
#include <asm/daifflags.h>
#include <asm/fpsimd.h>
#include <asm/mte.h>
#include <asm/stacktrace.h>
+enum ptrace_syscall_dir {
+ PTRACE_SYSCALL_ENTER = 0,
+ PTRACE_SYSCALL_EXIT,
+};
+
#define ARCH_EXIT_TO_USER_MODE_WORK (_TIF_MTE_ASYNC_FAULT | _TIF_FOREIGN_FPSTATE)
static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
@@ -54,4 +61,73 @@ static inline bool arch_irqentry_exit_need_resched(void)
#define arch_irqentry_exit_need_resched arch_irqentry_exit_need_resched
+static __always_inline unsigned long ptrace_save_reg(struct pt_regs *regs,
+ enum ptrace_syscall_dir dir,
+ int *regno)
+{
+ unsigned long saved_reg;
+
+ /*
+ * We have some ABI weirdness here in the way that we handle syscall
+ * exit stops because we indicate whether or not the stop has been
+ * signalled from syscall entry or syscall exit by clobbering a general
+ * purpose register (ip/r12 for AArch32, x7 for AArch64) in the tracee
+ * and restoring its old value after the stop. This means that:
+ *
+ * - Any writes by the tracer to this register during the stop are
+ * ignored/discarded.
+ *
+ * - The actual value of the register is not available during the stop,
+ * so the tracer cannot save it and restore it later.
+ *
+ * - Syscall stops behave differently to seccomp and pseudo-step traps
+ * (the latter do not nobble any registers).
+ */
+ *regno = (is_compat_task() ? 12 : 7);
+ saved_reg = regs->regs[*regno];
+ regs->regs[*regno] = dir;
+
+ return saved_reg;
+}
+
+static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs)
+{
+ unsigned long saved_reg;
+ int regno, ret;
+
+ saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_ENTER, ®no);
+ ret = ptrace_report_syscall_entry(regs);
+ if (ret)
+ forget_syscall(regs);
+ regs->regs[regno] = saved_reg;
+
+ return ret;
+}
+
+#define arch_ptrace_report_syscall_entry arch_ptrace_report_syscall_entry
+
+static __always_inline void arch_ptrace_report_syscall_exit(struct pt_regs *regs,
+ int step)
+{
+ unsigned long saved_reg;
+ int regno;
+
+ saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_EXIT, ®no);
+ if (!step) {
+ ptrace_report_syscall_exit(regs, 0);
+ regs->regs[regno] = saved_reg;
+ } else {
+ regs->regs[regno] = saved_reg;
+
+ /*
+ * Signal a pseudo-step exception since we are stepping but
+ * tracer modifications to the registers may have rewound the
+ * state machine.
+ */
+ ptrace_report_syscall_exit(regs, 1);
+ }
+}
+
+#define arch_ptrace_report_syscall_exit arch_ptrace_report_syscall_exit
+
#endif /* _ASM_ARM64_ENTRY_COMMON_H */
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index dea392c081ca..240d45735cc5 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -9,6 +9,9 @@
#include <linux/compat.h>
#include <linux/err.h>
+#include <asm/compat.h>
+#include <asm/vdso.h>
+
typedef long (*syscall_fn_t)(const struct pt_regs *regs);
extern const syscall_fn_t sys_call_table[];
@@ -120,7 +123,19 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_AARCH64;
}
-int syscall_trace_enter(struct pt_regs *regs, unsigned long flags);
-void syscall_exit_to_user_mode_work(struct pt_regs *regs);
+static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
+{
+ unsigned long sigtramp;
+
+#ifdef CONFIG_COMPAT
+ if (is_compat_task()) {
+ unsigned long sigpage = (unsigned long)current->mm->context.sigpage;
+
+ return regs->pc >= sigpage && regs->pc < (sigpage + PAGE_SIZE);
+ }
+#endif
+ sigtramp = (unsigned long)VDSO_SYMBOL(current->mm->context.vdso, sigtramp);
+ return regs->pc == (sigtramp + 8);
+}
#endif /* __ASM_SYSCALL_H */
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 4ae83cb620bb..f89a15dc6ad5 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -43,6 +43,7 @@ struct thread_info {
void *scs_sp;
#endif
u32 cpu;
+ unsigned long syscall_work; /* SYSCALL_WORK_ flags */
};
#define thread_saved_pc(tsk) \
@@ -65,11 +66,6 @@ void arch_setup_new_exec(void);
#define TIF_UPROBE 5 /* uprobe breakpoint or singlestep */
#define TIF_MTE_ASYNC_FAULT 6 /* MTE Asynchronous Tag Check Fault */
#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */
-#define TIF_SYSCALL_TRACE 8 /* syscall trace active */
-#define TIF_SYSCALL_AUDIT 9 /* syscall auditing */
-#define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */
-#define TIF_SECCOMP 11 /* syscall secure computing */
-#define TIF_SYSCALL_EMU 12 /* syscall emulation active */
#define TIF_PATCH_PENDING 13 /* pending live patching update */
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_FREEZE 19
@@ -91,27 +87,14 @@ void arch_setup_new_exec(void);
#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE)
-#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
-#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
-#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
-#define _TIF_SECCOMP (1 << TIF_SECCOMP)
-#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
#define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING)
#define _TIF_UPROBE (1 << TIF_UPROBE)
-#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
#define _TIF_32BIT (1 << TIF_32BIT)
#define _TIF_SVE (1 << TIF_SVE)
#define _TIF_MTE_ASYNC_FAULT (1 << TIF_MTE_ASYNC_FAULT)
#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
#define _TIF_TSC_SIGSEGV (1 << TIF_TSC_SIGSEGV)
-#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
- _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
- _TIF_SYSCALL_EMU)
-
-#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
- _TIF_SYSCALL_TRACEPOINT)
-
#ifdef CONFIG_SHADOW_CALL_STACK
#define INIT_SCS \
.scs_base = init_shadow_call_stack, \
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 29307642f4c9..e67643a70405 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -385,11 +385,18 @@ void user_enable_single_step(struct task_struct *task)
if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP))
set_regs_spsr_ss(task_pt_regs(task));
+
+ /*
+ * Ensure that a trap is triggered once stepping out of a system
+ * call prior to executing any user instruction.
+ */
+ set_task_syscall_work(task, SYSCALL_EXIT_TRAP);
}
NOKPROBE_SYMBOL(user_enable_single_step);
void user_disable_single_step(struct task_struct *task)
{
clear_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP);
+ clear_task_syscall_work(task, SYSCALL_EXIT_TRAP);
}
NOKPROBE_SYMBOL(user_disable_single_step);
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index 3625797e9ee8..b7ac88bb946c 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -64,6 +64,12 @@ static void noinstr exit_to_kernel_mode(struct pt_regs *regs,
* instrumentable code, or any code which may trigger an exception.
*/
static __always_inline void arm64_enter_from_user_mode(struct pt_regs *regs)
+{
+ irqentry_enter_from_user_mode(regs);
+ mte_disable_tco_entry(current);
+}
+
+static __always_inline void arm64_syscall_enter_from_user_mode(struct pt_regs *regs)
{
enter_from_user_mode(regs);
mte_disable_tco_entry(current);
@@ -78,7 +84,16 @@ static __always_inline void arm64_enter_from_user_mode(struct pt_regs *regs)
static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs)
{
local_irq_disable();
- exit_to_user_mode_prepare_legacy(regs);
+ irqentry_exit_to_user_mode_prepare(regs);
+ local_daif_mask();
+ mte_check_tfsr_exit();
+ exit_to_user_mode();
+}
+
+static __always_inline void arm64_syscall_exit_to_user_mode(struct pt_regs *regs)
+{
+ local_irq_disable();
+ syscall_exit_to_user_mode_prepare(regs);
local_daif_mask();
mte_check_tfsr_exit();
exit_to_user_mode();
@@ -717,12 +732,12 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr)
static void noinstr el0_svc(struct pt_regs *regs)
{
- arm64_enter_from_user_mode(regs);
+ arm64_syscall_enter_from_user_mode(regs);
cortex_a76_erratum_1463225_svc_handler();
fpsimd_syscall_enter();
local_daif_restore(DAIF_PROCCTX);
do_el0_svc(regs);
- arm64_exit_to_user_mode(regs);
+ arm64_syscall_exit_to_user_mode(regs);
fpsimd_syscall_exit();
}
@@ -869,11 +884,11 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr)
static void noinstr el0_svc_compat(struct pt_regs *regs)
{
- arm64_enter_from_user_mode(regs);
+ arm64_syscall_enter_from_user_mode(regs);
cortex_a76_erratum_1463225_svc_handler();
local_daif_restore(DAIF_PROCCTX);
do_el0_svc_compat(regs);
- arm64_exit_to_user_mode(regs);
+ arm64_syscall_exit_to_user_mode(regs);
}
static void noinstr el0_bkpt32(struct pt_regs *regs, unsigned long esr)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index e3b74add88e7..9acc314bc376 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -8,7 +8,6 @@
* Copyright (C) 2012 ARM Ltd.
*/
-#include <linux/audit.h>
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/sched/signal.h>
@@ -18,7 +17,6 @@
#include <linux/smp.h>
#include <linux/ptrace.h>
#include <linux/user.h>
-#include <linux/seccomp.h>
#include <linux/security.h>
#include <linux/init.h>
#include <linux/signal.h>
@@ -28,7 +26,6 @@
#include <linux/hw_breakpoint.h>
#include <linux/regset.h>
#include <linux/elf.h>
-#include <linux/rseq.h>
#include <asm/compat.h>
#include <asm/cpufeature.h>
@@ -38,13 +35,9 @@
#include <asm/mte.h>
#include <asm/pointer_auth.h>
#include <asm/stacktrace.h>
-#include <asm/syscall.h>
#include <asm/traps.h>
#include <asm/system_misc.h>
-#define CREATE_TRACE_POINTS
-#include <trace/events/syscalls.h>
-
struct pt_regs_offset {
const char *name;
int offset;
@@ -2339,153 +2332,6 @@ long arch_ptrace(struct task_struct *child, long request,
return ptrace_request(child, request, addr, data);
}
-enum ptrace_syscall_dir {
- PTRACE_SYSCALL_ENTER = 0,
- PTRACE_SYSCALL_EXIT,
-};
-
-static __always_inline unsigned long ptrace_save_reg(struct pt_regs *regs,
- enum ptrace_syscall_dir dir,
- int *regno)
-{
- unsigned long saved_reg;
-
- /*
- * We have some ABI weirdness here in the way that we handle syscall
- * exit stops because we indicate whether or not the stop has been
- * signalled from syscall entry or syscall exit by clobbering a general
- * purpose register (ip/r12 for AArch32, x7 for AArch64) in the tracee
- * and restoring its old value after the stop. This means that:
- *
- * - Any writes by the tracer to this register during the stop are
- * ignored/discarded.
- *
- * - The actual value of the register is not available during the stop,
- * so the tracer cannot save it and restore it later.
- *
- * - Syscall stops behave differently to seccomp and pseudo-step traps
- * (the latter do not nobble any registers).
- */
- *regno = (is_compat_task() ? 12 : 7);
- saved_reg = regs->regs[*regno];
- regs->regs[*regno] = dir;
-
- return saved_reg;
-}
-
-static int report_syscall_entry(struct pt_regs *regs)
-{
- unsigned long saved_reg;
- int regno, ret;
-
- saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_ENTER, ®no);
- ret = ptrace_report_syscall_entry(regs);
- if (ret)
- forget_syscall(regs);
- regs->regs[regno] = saved_reg;
-
- return ret;
-}
-
-static void report_syscall_exit(struct pt_regs *regs)
-{
- unsigned long saved_reg;
- int regno;
-
- saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_EXIT, ®no);
- if (!test_thread_flag(TIF_SINGLESTEP)) {
- ptrace_report_syscall_exit(regs, 0);
- regs->regs[regno] = saved_reg;
- } else {
- regs->regs[regno] = saved_reg;
-
- /*
- * Signal a pseudo-step exception since we are stepping but
- * tracer modifications to the registers may have rewound the
- * state machine.
- */
- ptrace_report_syscall_exit(regs, 1);
- }
-}
-
-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;
- int ret = 0;
-
- if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
- ret = report_syscall_entry(regs);
- if (ret || (flags & _TIF_SYSCALL_EMU))
- return NO_SYSCALL;
- }
-
- /* Do the secure computing after ptrace; failures should be fast. */
- if (flags & _TIF_SECCOMP) {
- ret = __secure_computing();
- if (ret == -1)
- return NO_SYSCALL;
- }
-
- /* Either of the above might have changed the syscall number */
- syscall = syscall_get_nr(current, regs);
-
- if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) {
- trace_sys_enter(regs, syscall);
-
- /*
- * Probes or BPF hooks in the tracepoint may have changed the
- * system call number as well.
- */
- syscall = syscall_get_nr(current, regs);
- }
-
- syscall_enter_audit(regs, syscall);
-
- return ret ? : syscall;
-}
-
-static inline bool report_single_step(unsigned long flags)
-{
- if (flags & _TIF_SYSCALL_EMU)
- return false;
-
- return flags & _TIF_SINGLESTEP;
-}
-
-static void syscall_exit_work(struct pt_regs *regs, unsigned long flags)
-{
- bool step;
-
- audit_syscall_exit(regs);
-
- if (flags & _TIF_SYSCALL_TRACEPOINT)
- trace_sys_exit(regs, syscall_get_return_value(current, regs));
-
- step = report_single_step(flags);
- if (step || flags & _TIF_SYSCALL_TRACE)
- report_syscall_exit(regs);
-}
-
-void syscall_exit_to_user_mode_work(struct pt_regs *regs)
-{
- unsigned long flags = read_thread_flags();
-
- rseq_syscall(regs);
-
- if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP)
- syscall_exit_work(regs, flags);
-}
-
/*
* SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a.
* We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 08ffc5a5aea4..7ca30ee41e7a 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -8,8 +8,8 @@
#include <linux/cache.h>
#include <linux/compat.h>
+#include <linux/entry-common.h>
#include <linux/errno.h>
-#include <linux/irq-entry-common.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/freezer.h>
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index ec478fc37a9f..77d00a5cf0e9 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -2,6 +2,7 @@
#include <linux/compiler.h>
#include <linux/context_tracking.h>
+#include <linux/entry-common.h>
#include <linux/errno.h>
#include <linux/nospec.h>
#include <linux/ptrace.h>
@@ -68,6 +69,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
const syscall_fn_t syscall_table[])
{
+ unsigned long work = READ_ONCE(current_thread_info()->syscall_work);
unsigned long flags = read_thread_flags();
regs->orig_x0 = regs->regs[0];
@@ -101,7 +103,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
return;
}
- if (unlikely(flags & _TIF_SYSCALL_WORK)) {
+ if (unlikely(work & SYSCALL_WORK_ENTER)) {
/*
* The de-facto standard way to skip a system call using ptrace
* is to set the system call to -1 (NO_SYSCALL) and set x0 to a
@@ -119,7 +121,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
*/
if (scno == NO_SYSCALL)
syscall_set_return_value(current, regs, -ENOSYS, 0);
- scno = syscall_trace_enter(regs, flags);
+ scno = syscall_trace_enter(regs, work);
if (scno == NO_SYSCALL)
goto trace_exit;
}
diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h
index d26d1b1bcbfb..6519b4a30dc1 100644
--- a/include/linux/irq-entry-common.h
+++ b/include/linux/irq-entry-common.h
@@ -236,14 +236,6 @@ static __always_inline void __exit_to_user_mode_validate(void)
lockdep_sys_exit();
}
-/* Temporary workaround to keep ARM64 alive */
-static __always_inline void exit_to_user_mode_prepare_legacy(struct pt_regs *regs)
-{
- __exit_to_user_mode_prepare(regs);
- rseq_exit_to_user_mode_legacy();
- __exit_to_user_mode_validate();
-}
-
/**
* syscall_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required
* @regs: Pointer to pt_regs on entry stack
diff --git a/include/linux/rseq_entry.h b/include/linux/rseq_entry.h
index c6831c93cd6e..e9c4108ac514 100644
--- a/include/linux/rseq_entry.h
+++ b/include/linux/rseq_entry.h
@@ -743,24 +743,6 @@ static __always_inline void rseq_irqentry_exit_to_user_mode(void)
ev->events = 0;
}
-/* Required to keep ARM64 working */
-static __always_inline void rseq_exit_to_user_mode_legacy(void)
-{
- struct rseq_event *ev = ¤t->rseq.event;
-
- rseq_stat_inc(rseq_stats.exit);
-
- if (static_branch_unlikely(&rseq_debug_enabled))
- WARN_ON_ONCE(ev->sched_switch);
-
- /*
- * Ensure that event (especially user_irq) is cleared when the
- * interrupt did not result in a schedule and therefore the
- * rseq processing did not clear it.
- */
- ev->events = 0;
-}
-
void __rseq_debug_syscall_return(struct pt_regs *regs);
static __always_inline void rseq_debug_syscall_return(struct pt_regs *regs)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v14 10/10] arm64: Inline el0_svc_common()
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (8 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 09/10] arm64: entry: Convert to generic entry Jinjie Ruan
@ 2026-03-20 10:26 ` Jinjie Ruan
2026-04-09 6:29 ` [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
10 siblings, 0 replies; 13+ messages in thread
From: Jinjie Ruan @ 2026-03-20 10:26 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
ruanjinjie, linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
After converting arm64 to Generic Entry framework, the compiler no longer
inlines el0_svc_common() into its caller do_el0_svc(). This introduces
a small but measurable overhead in the critical system call path.
Manually forcing el0_svc_common() to be inlined restores the
performance. Benchmarking with perf bench syscall basic on a
Kunpeng 920 platform (based on v6.19-rc1) shows a ~1% performance
uplift.
Inlining this function reduces function prologue/epilogue overhead
and allows for better compiler optimization in the hot system call
dispatch path.
| Metric | W/O this patch | With this patch | Change |
| ---------- | -------------- | --------------- | --------- |
| Total time | 2.195 [sec] | 2.171 [sec] | ↓1.1% |
| usecs/op | 0.219575 | 0.217192 | ↓1.1% |
| ops/sec | 4,554,260 | 4,604,225 | ↑1.1% |
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/arm64/kernel/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index 77d00a5cf0e9..6fcd97c46716 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -66,8 +66,8 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
choose_random_kstack_offset(get_random_u16());
}
-static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
- const syscall_fn_t syscall_table[])
+static __always_inline void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
+ const syscall_fn_t syscall_table[])
{
unsigned long work = READ_ONCE(current_thread_info()->syscall_work);
unsigned long flags = read_thread_flags();
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v14 00/10] arm64: entry: Convert to Generic Entry
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
` (9 preceding siblings ...)
2026-03-20 10:26 ` [PATCH v14 10/10] arm64: Inline el0_svc_common() Jinjie Ruan
@ 2026-04-09 6:29 ` Jinjie Ruan
2026-04-09 7:36 ` Mark Rutland
10 siblings, 1 reply; 13+ messages in thread
From: Jinjie Ruan @ 2026-04-09 6:29 UTC (permalink / raw)
To: catalin.marinas, will, oleg, tglx, peterz, luto, kees, wad,
linusw, kevin.brodsky, yeoreum.yun, ldv, song, thuth,
ryan.roberts, mark.rutland, ada.coupriediaz, anshuman.khandual,
broonie, liqiang01, pengcan, mathieu.desnoyers, mingo, edumazet,
arnd, linux-arm-kernel, linux-kernel
On 2026/3/20 18:26, Jinjie Ruan wrote:
> Currently, x86, Riscv, Loongarch use the Generic Entry which makes
> maintainers' work easier and codes more elegant. arm64 has already
> successfully switched to the Generic IRQ Entry in commit
> b3cf07851b6c ("arm64: entry: Switch to generic IRQ entry"), it is
> time to completely convert arm64 to Generic Entry.
>
> The goal is to bring arm64 in line with other architectures that already
> use the generic entry infrastructure, reducing duplicated code and
> making it easier to share future changes in entry/exit paths, such as
> "Syscall User Dispatch" and RSEQ optimizations.
Hi,
Just a quick ping to see if this series is good to go. Do I need to
provide a new version rebased on the latest arm64 for-next/generic-entry
branches, or is the current version acceptable?
>
> This patch set is rebased on arm64 for-next/core. This series contains
> foundational updates for arm64. As suggested by Linus Walleij, these 10
> patches are being submitted separately for inclusion in the arm64 tree.
>
> And the performance benchmarks results on qemu-kvm are below:
>
> perf bench syscall usec/op (-ve is improvement)
>
> | Syscall | Base | Generic Entry | change % |
> | ------- | ----------- | ------------- | -------- |
> | basic | 0.123997 | 0.120872 | -2.57 |
> | execve | 512.1173 | 504.9966 | -1.52 |
> | fork | 114.1144 | 113.2301 | -1.06 |
> | getpgid | 0.120182 | 0.121245 | +0.9 |
>
> perf bench syscall ops/sec (+ve is improvement)
>
> | Syscall | Base | Generic Entry| change % |
> | ------- | -------- | ------------ | -------- |
> | basic | 8064712 | 8273212 | +2.48 |
> | execve | 1952 | 1980 | +1.52 |
> | fork | 8763 | 8832 | +1.06 |
> | getpgid | 8320704 | 8247810 | -0.9 |
>
> Therefore, the syscall performance variation ranges from a 1% regression
> to a 2.5% improvement.
>
> It was tested ok with following test cases on QEMU virt platform:
> - Stress-ng CPU stress test.
> - Hackbench stress test.
> - "sud" selftest testcase.
> - get_set_sud, get_syscall_info, set_syscall_info, peeksiginfo
> in tools/testing/selftests/ptrace.
> - breakpoint_test_arm64 in selftests/breakpoints.
> - syscall-abi and ptrace in tools/testing/selftests/arm64/abi
> - fp-ptrace, sve-ptrace, za-ptrace in selftests/arm64/fp.
> - vdso_test_getrandom in tools/testing/selftests/vDSO
> - Strace tests.
> - slice_test for rseq optimizations.
>
> The test QEMU configuration is as follows:
>
> qemu-system-aarch64 \
> -M virt \
> -enable-kvm \
> -cpu host \
> -kernel Image \
> -smp 8 \
> -m 512m \
> -nographic \
> -no-reboot \
> -device virtio-rng-pci \
> -append "root=/dev/vda rw console=ttyAMA0 kgdboc=ttyAMA0,115200 \
> earlycon preempt=voluntary irqchip.gicv3_pseudo_nmi=1 audit=1" \
> -drive if=none,file=images/rootfs.ext4,format=raw,id=hd0 \
> -device virtio-blk-device,drive=hd0 \
>
> Changes in v14:
> - Initialize ret = 0 in syscall_trace_enter().
> - Split into two patch sets as Linus Walleij suggested, so this patch set
> can be applied separately to the arm64 tree.
> - Rebased on arm64 for-next/core branch.
> - Collect Reviewed-by and Acked-by.
> - Link to v13 resend: https://lore.kernel.org/all/20260317082020.737779-15-ruanjinjie@huawei.com/
>
> Changes in v13 resend:
> - Fix exit_to_user_mode_prepare_legacy() issues.
> - Also move TIF_SINGLESTEP to generic TIF infrastructure for loongarch.
> - Use generic TIF bits for arm64 and moving TIF_SINGLESTEP to
> generic TIF for related architectures separately.
> - Refactor syscall_trace_enter/exit() to accept flags and Use
> syscall_get_nr() helper separately.
> - Tested with slice_test for rseq optimizations.
> - Add acked-by.
> - Link to v13: https://lore.kernel.org/all/20260313094738.3985794-1-ruanjinjie@huawei.com/
>
> Changes in v13:
> - Rebased on v7.0-rc3, so drop the firt applied arm64 patch.
> - Use generic TIF bits to enables RSEQ optimization.
> - Update most of the commit message to make it more clear.
> - Link to v12: https://lore.kernel.org/all/20260203133728.848283-1-ruanjinjie@huawei.com/
>
> Changes in v12:
> - Rebased on "sched/core", so remove the four generic entry patches.
> - Move "Expand secure_computing() in place" and
> "Use syscall_get_arguments() helper" patch forward, which will group all
> non-functional cleanups at the front.
> - Adjust the explanation for moving rseq_syscall() before
> audit_syscall_exit().
> - Link to v11: https://lore.kernel.org/all/20260128031934.3906955-1-ruanjinjie@huawei.com/
>
> Changes in v11:
> - Remove unused syscall in syscall_trace_enter().
> - Update and provide a detailed explanation of the differences after
> moving rseq_syscall() before audit_syscall_exit().
> - Rebased on arm64 (for-next/entry), and remove the first applied 3 patchs.
> - syscall_exit_to_user_mode_work() for arch reuse instead of adding
> new syscall_exit_to_user_mode_work_prepare() helper.
> - Link to v10: https://lore.kernel.org/all/20251222114737.1334364-1-ruanjinjie@huawei.com/
>
> Changes in v10:
> - Rebased on v6.19-rc1, rename syscall_exit_to_user_mode_prepare() to
> syscall_exit_to_user_mode_work_prepare() to avoid conflict.
> - Also inline syscall_trace_enter().
> - Support aarch64 for sud_benchmark.
> - Update and correct the commit message.
> - Add Reviewed-by.
> - Link to v9: https://lore.kernel.org/all/20251204082123.2792067-1-ruanjinjie@huawei.com/
>
> Changes in v9:
> - Move "Return early for ptrace_report_syscall_entry() error" patch ahead
> to make it not introduce a regression.
> - Not check _TIF_SECCOMP/SYSCALL_EMU for syscall_exit_work() in
> a separate patch.
> - Do not report_syscall_exit() for PTRACE_SYSEMU_SINGLESTEP in a separate
> patch.
> - Add two performance patch to improve the arm64 performance.
> - Add Reviewed-by.
> - Link to v8: https://lore.kernel.org/all/20251126071446.3234218-1-ruanjinjie@huawei.com/
>
> Changes in v8:
> - Rename "report_syscall_enter()" to "report_syscall_entry()".
> - Add ptrace_save_reg() to avoid duplication.
> - Remove unused _TIF_WORK_MASK in a standalone patch.
> - Align syscall_trace_enter() return value with the generic version.
> - Use "scno" instead of regs->syscallno in el0_svc_common().
> - Move rseq_syscall() ahead in a standalone patch to clarify it clearly.
> - Rename "syscall_trace_exit()" to "syscall_exit_work()".
> - Keep the goto in el0_svc_common().
> - No argument was passed to __secure_computing() and check -1 not -1L.
> - Remove "Add has_syscall_work() helper" patch.
> - Move "Add syscall_exit_to_user_mode_prepare() helper" patch later.
> - Add miss header for asm/entry-common.h.
> - Update the implementation of arch_syscall_is_vdso_sigreturn().
> - Add "ARCH_SYSCALL_WORK_EXIT" to be defined as "SECCOMP | SYSCALL_EMU"
> to keep the behaviour unchanged.
> - Add more testcases test.
> - Add Reviewed-by.
> - Update the commit message.
> - Link to v7: https://lore.kernel.org/all/20251117133048.53182-1-ruanjinjie@huawei.com/
>
> Jinjie Ruan (10):
> arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags
> parameter
> arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter()
> arm64/ptrace: Expand secure_computing() in place
> arm64/ptrace: Use syscall_get_arguments() helper for audit
> arm64: ptrace: Move rseq_syscall() before audit_syscall_exit()
> arm64: syscall: Introduce syscall_exit_to_user_mode_work()
> arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK
> arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP
> arm64: entry: Convert to generic entry
> arm64: Inline el0_svc_common()
>
> arch/arm64/Kconfig | 2 +-
> arch/arm64/include/asm/entry-common.h | 76 +++++++++++++++++
> arch/arm64/include/asm/syscall.h | 19 ++++-
> arch/arm64/include/asm/thread_info.h | 16 +---
> arch/arm64/kernel/debug-monitors.c | 7 ++
> arch/arm64/kernel/entry-common.c | 25 ++++--
> arch/arm64/kernel/ptrace.c | 115 --------------------------
> arch/arm64/kernel/signal.c | 2 +-
> arch/arm64/kernel/syscall.c | 29 ++-----
> include/linux/irq-entry-common.h | 8 --
> include/linux/rseq_entry.h | 18 ----
> 11 files changed, 130 insertions(+), 187 deletions(-)
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v14 00/10] arm64: entry: Convert to Generic Entry
2026-04-09 6:29 ` [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
@ 2026-04-09 7:36 ` Mark Rutland
0 siblings, 0 replies; 13+ messages in thread
From: Mark Rutland @ 2026-04-09 7:36 UTC (permalink / raw)
To: Jinjie Ruan
Cc: peterz, catalin.marinas, ldv, song, edumazet, will, mingo, kees,
thuth, ryan.roberts, arnd, anshuman.khandual, kevin.brodsky,
pengcan, broonie, mathieu.desnoyers, luto, linux-arm-kernel, wad,
linusw, oleg, linux-kernel, tglx, liqiang01, yeoreum.yun
Hi Jinjie,
On Thu, Apr 09, 2026 at 02:29:04PM +0800, Jinjie Ruan wrote:
> On 2026/3/20 18:26, Jinjie Ruan wrote:
> > Currently, x86, Riscv, Loongarch use the Generic Entry which makes
> > maintainers' work easier and codes more elegant. arm64 has already
> > successfully switched to the Generic IRQ Entry in commit
> > b3cf07851b6c ("arm64: entry: Switch to generic IRQ entry"), it is
> > time to completely convert arm64 to Generic Entry.
> >
> > The goal is to bring arm64 in line with other architectures that already
> > use the generic entry infrastructure, reducing duplicated code and
> > making it easier to share future changes in entry/exit paths, such as
> > "Syscall User Dispatch" and RSEQ optimizations.
>
> Hi,
>
> Just a quick ping to see if this series is good to go. Do I need to
> provide a new version rebased on the latest arm64 for-next/generic-entry
> branches, or is the current version acceptable?
Sorry, this is on my list to review, but I've been busy fixing other
issues (e.g. the preemption issues from moving to generic irqentry), and
haven't yet had the time to go over this in detail.
This series might be fine as-is, but given that it's incredibly easy to
introduce subtle and hard-to-fix regressions to user ABI, I don't think
we can assume that it's safe until we've gone over it thoroughly.
For the moment, no need to resend. If you haven't received comments by
v7.1-rc1, please rebase and resend then.
Thanks,
Mark.
> > This patch set is rebased on arm64 for-next/core. This series contains
> > foundational updates for arm64. As suggested by Linus Walleij, these 10
> > patches are being submitted separately for inclusion in the arm64 tree.
> >
> > And the performance benchmarks results on qemu-kvm are below:
> >
> > perf bench syscall usec/op (-ve is improvement)
> >
> > | Syscall | Base | Generic Entry | change % |
> > | ------- | ----------- | ------------- | -------- |
> > | basic | 0.123997 | 0.120872 | -2.57 |
> > | execve | 512.1173 | 504.9966 | -1.52 |
> > | fork | 114.1144 | 113.2301 | -1.06 |
> > | getpgid | 0.120182 | 0.121245 | +0.9 |
> >
> > perf bench syscall ops/sec (+ve is improvement)
> >
> > | Syscall | Base | Generic Entry| change % |
> > | ------- | -------- | ------------ | -------- |
> > | basic | 8064712 | 8273212 | +2.48 |
> > | execve | 1952 | 1980 | +1.52 |
> > | fork | 8763 | 8832 | +1.06 |
> > | getpgid | 8320704 | 8247810 | -0.9 |
> >
> > Therefore, the syscall performance variation ranges from a 1% regression
> > to a 2.5% improvement.
> >
> > It was tested ok with following test cases on QEMU virt platform:
> > - Stress-ng CPU stress test.
> > - Hackbench stress test.
> > - "sud" selftest testcase.
> > - get_set_sud, get_syscall_info, set_syscall_info, peeksiginfo
> > in tools/testing/selftests/ptrace.
> > - breakpoint_test_arm64 in selftests/breakpoints.
> > - syscall-abi and ptrace in tools/testing/selftests/arm64/abi
> > - fp-ptrace, sve-ptrace, za-ptrace in selftests/arm64/fp.
> > - vdso_test_getrandom in tools/testing/selftests/vDSO
> > - Strace tests.
> > - slice_test for rseq optimizations.
> >
> > The test QEMU configuration is as follows:
> >
> > qemu-system-aarch64 \
> > -M virt \
> > -enable-kvm \
> > -cpu host \
> > -kernel Image \
> > -smp 8 \
> > -m 512m \
> > -nographic \
> > -no-reboot \
> > -device virtio-rng-pci \
> > -append "root=/dev/vda rw console=ttyAMA0 kgdboc=ttyAMA0,115200 \
> > earlycon preempt=voluntary irqchip.gicv3_pseudo_nmi=1 audit=1" \
> > -drive if=none,file=images/rootfs.ext4,format=raw,id=hd0 \
> > -device virtio-blk-device,drive=hd0 \
> >
> > Changes in v14:
> > - Initialize ret = 0 in syscall_trace_enter().
> > - Split into two patch sets as Linus Walleij suggested, so this patch set
> > can be applied separately to the arm64 tree.
> > - Rebased on arm64 for-next/core branch.
> > - Collect Reviewed-by and Acked-by.
> > - Link to v13 resend: https://lore.kernel.org/all/20260317082020.737779-15-ruanjinjie@huawei.com/
> >
> > Changes in v13 resend:
> > - Fix exit_to_user_mode_prepare_legacy() issues.
> > - Also move TIF_SINGLESTEP to generic TIF infrastructure for loongarch.
> > - Use generic TIF bits for arm64 and moving TIF_SINGLESTEP to
> > generic TIF for related architectures separately.
> > - Refactor syscall_trace_enter/exit() to accept flags and Use
> > syscall_get_nr() helper separately.
> > - Tested with slice_test for rseq optimizations.
> > - Add acked-by.
> > - Link to v13: https://lore.kernel.org/all/20260313094738.3985794-1-ruanjinjie@huawei.com/
> >
> > Changes in v13:
> > - Rebased on v7.0-rc3, so drop the firt applied arm64 patch.
> > - Use generic TIF bits to enables RSEQ optimization.
> > - Update most of the commit message to make it more clear.
> > - Link to v12: https://lore.kernel.org/all/20260203133728.848283-1-ruanjinjie@huawei.com/
> >
> > Changes in v12:
> > - Rebased on "sched/core", so remove the four generic entry patches.
> > - Move "Expand secure_computing() in place" and
> > "Use syscall_get_arguments() helper" patch forward, which will group all
> > non-functional cleanups at the front.
> > - Adjust the explanation for moving rseq_syscall() before
> > audit_syscall_exit().
> > - Link to v11: https://lore.kernel.org/all/20260128031934.3906955-1-ruanjinjie@huawei.com/
> >
> > Changes in v11:
> > - Remove unused syscall in syscall_trace_enter().
> > - Update and provide a detailed explanation of the differences after
> > moving rseq_syscall() before audit_syscall_exit().
> > - Rebased on arm64 (for-next/entry), and remove the first applied 3 patchs.
> > - syscall_exit_to_user_mode_work() for arch reuse instead of adding
> > new syscall_exit_to_user_mode_work_prepare() helper.
> > - Link to v10: https://lore.kernel.org/all/20251222114737.1334364-1-ruanjinjie@huawei.com/
> >
> > Changes in v10:
> > - Rebased on v6.19-rc1, rename syscall_exit_to_user_mode_prepare() to
> > syscall_exit_to_user_mode_work_prepare() to avoid conflict.
> > - Also inline syscall_trace_enter().
> > - Support aarch64 for sud_benchmark.
> > - Update and correct the commit message.
> > - Add Reviewed-by.
> > - Link to v9: https://lore.kernel.org/all/20251204082123.2792067-1-ruanjinjie@huawei.com/
> >
> > Changes in v9:
> > - Move "Return early for ptrace_report_syscall_entry() error" patch ahead
> > to make it not introduce a regression.
> > - Not check _TIF_SECCOMP/SYSCALL_EMU for syscall_exit_work() in
> > a separate patch.
> > - Do not report_syscall_exit() for PTRACE_SYSEMU_SINGLESTEP in a separate
> > patch.
> > - Add two performance patch to improve the arm64 performance.
> > - Add Reviewed-by.
> > - Link to v8: https://lore.kernel.org/all/20251126071446.3234218-1-ruanjinjie@huawei.com/
> >
> > Changes in v8:
> > - Rename "report_syscall_enter()" to "report_syscall_entry()".
> > - Add ptrace_save_reg() to avoid duplication.
> > - Remove unused _TIF_WORK_MASK in a standalone patch.
> > - Align syscall_trace_enter() return value with the generic version.
> > - Use "scno" instead of regs->syscallno in el0_svc_common().
> > - Move rseq_syscall() ahead in a standalone patch to clarify it clearly.
> > - Rename "syscall_trace_exit()" to "syscall_exit_work()".
> > - Keep the goto in el0_svc_common().
> > - No argument was passed to __secure_computing() and check -1 not -1L.
> > - Remove "Add has_syscall_work() helper" patch.
> > - Move "Add syscall_exit_to_user_mode_prepare() helper" patch later.
> > - Add miss header for asm/entry-common.h.
> > - Update the implementation of arch_syscall_is_vdso_sigreturn().
> > - Add "ARCH_SYSCALL_WORK_EXIT" to be defined as "SECCOMP | SYSCALL_EMU"
> > to keep the behaviour unchanged.
> > - Add more testcases test.
> > - Add Reviewed-by.
> > - Update the commit message.
> > - Link to v7: https://lore.kernel.org/all/20251117133048.53182-1-ruanjinjie@huawei.com/
> >
> > Jinjie Ruan (10):
> > arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags
> > parameter
> > arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter()
> > arm64/ptrace: Expand secure_computing() in place
> > arm64/ptrace: Use syscall_get_arguments() helper for audit
> > arm64: ptrace: Move rseq_syscall() before audit_syscall_exit()
> > arm64: syscall: Introduce syscall_exit_to_user_mode_work()
> > arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK
> > arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP
> > arm64: entry: Convert to generic entry
> > arm64: Inline el0_svc_common()
> >
> > arch/arm64/Kconfig | 2 +-
> > arch/arm64/include/asm/entry-common.h | 76 +++++++++++++++++
> > arch/arm64/include/asm/syscall.h | 19 ++++-
> > arch/arm64/include/asm/thread_info.h | 16 +---
> > arch/arm64/kernel/debug-monitors.c | 7 ++
> > arch/arm64/kernel/entry-common.c | 25 ++++--
> > arch/arm64/kernel/ptrace.c | 115 --------------------------
> > arch/arm64/kernel/signal.c | 2 +-
> > arch/arm64/kernel/syscall.c | 29 ++-----
> > include/linux/irq-entry-common.h | 8 --
> > include/linux/rseq_entry.h | 18 ----
> > 11 files changed, 130 insertions(+), 187 deletions(-)
> >
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-04-09 7:36 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 10:26 [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 01/10] arm64/ptrace: Refactor syscall_trace_enter/exit() to accept flags parameter Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 02/10] arm64/ptrace: Use syscall_get_nr() helper for syscall_trace_enter() Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 03/10] arm64/ptrace: Expand secure_computing() in place Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 04/10] arm64/ptrace: Use syscall_get_arguments() helper for audit Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 05/10] arm64: ptrace: Move rseq_syscall() before audit_syscall_exit() Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 06/10] arm64: syscall: Introduce syscall_exit_to_user_mode_work() Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 07/10] arm64/ptrace: Define and use _TIF_SYSCALL_EXIT_WORK Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 08/10] arm64/ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 09/10] arm64: entry: Convert to generic entry Jinjie Ruan
2026-03-20 10:26 ` [PATCH v14 10/10] arm64: Inline el0_svc_common() Jinjie Ruan
2026-04-09 6:29 ` [PATCH v14 00/10] arm64: entry: Convert to Generic Entry Jinjie Ruan
2026-04-09 7:36 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox