[PATCH v17 12/15] arm64: ptrace: Make return type of arm64_syscall_trace_enter() bool

Linus Walleij linusw at kernel.org
Tue Jul 21 01:52:29 PDT 2026


On Tue, Jul 21, 2026 at 10:19 AM Jinjie Ruan <ruanjinjie at huawei.com> 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 at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Ada Couprie Diaz <ada.coupriediaz at arm.com>
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>

Reviewed-by: Linus Walleij <linusw at kernel.org>

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list