Re: [PATCH v17 12/15] arm64: ptrace: Make return type of arm64_syscall_trace_enter() bool
From: Linus Walleij
Date: Tue Jul 21 2026 - 05:00:38 EST
On Tue, Jul 21, 2026 at 10:19 AM Jinjie Ruan <ruanjinjie@xxxxxxxxxx> wrote:
> In preparation for migrating arm64 to the generic entry infrastructure,
> decouple the decision to execute the syscall from the syscall number
> itself. The ptrace and seccomp now returns a boolean flag rather than
> overloading NO_SYSCALL (-1).
>
> Changes:
> - arm64_syscall_trace_enter() returns bool:
> - false: abort syscall execution
> - true: proceed, with syscall number reread from regs
> - If we decide to execute the syscall, reread the syscall number
> and check if it is NO_SYSCALL again. Because when a tracer sets
> the syscall number to -1 and provides a custom return value in x0,
> this avoids calling invoke_syscall() which would overwrite the custom
> value with -ENOSYS by sys_ni_syscall().
>
> Behavioral impact (unchanged):
> - User-issued syscall(-1): unchanged, returns -ENOSYS.
> - Tracer skip with custom x0: unchanged, returns custom x0
> - Tracer skip without setting x0: unchanged, returns original
> argument (garbage)
> - Normal syscalls and seccomp rejects: unaffected
>
> No functional changes.
>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Ada Couprie Diaz <ada.coupriediaz@xxxxxxx>
> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij