On Tue, Mar 17, 2026 at 9:20 AM Jinjie Ruan <[email protected]> wrote:

> 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. rseq_syscall() will be replaced with the static key version, that is
>    "rseq_debug_syscall_return()"
>
> 6. 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 <[email protected]>
> Cc: Catalin Marinas <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Reviewed-by: Kevin Brodsky <[email protected]>
> Suggested-by: Kevin Brodsky <[email protected]>
> Suggested-by: Mark Rutland <[email protected]>
> Signed-off-by: Jinjie Ruan <[email protected]>

This looks really neat.
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

Reply via email to