Re: [PATCH v2 2/2] selftests/seccomp: add sparc64 support

From: Kees Cook

Date: Fri Oct 09 2026 - 03:39:01 EST


On Wed, Sep 02, 2026 at 09:27:45AM +0200, Stian Halseth wrote:
> sparc64 now selects HAVE_ARCH_SECCOMP_FILTER, so teach seccomp_bpf
> how to read and write its registers: the syscall number lives in %g1
> and the return value in %o0. The NT_PRSTATUS regset appends the
> register window read back from the tracee's stack and has no exported
> layout, so use the sparc-specific PTRACE_GETREGS64/PTRACE_SETREGS64
> requests instead, which transfer the uapi struct pt_regs directly.
>
> Errors are signaled by the carry bit in tstate with a positive errno
> value in %o0, so provide a SYSCALL_RET_SET that maintains both, and
> mark the arch SYSCALL_RET_SET_ON_PTRACE_EXIT since a return value
> poked at entry would be overwritten by the syscall skip path, as on
> powerpc.
>
> Passes 95 of 95 on an UltraSPARC T4-1 (16 skipped for missing
> optional features such as uprobes).
>
> Link: https://github.com/sparclinux/issues/issues/11
> Signed-off-by: Stian Halseth <stian@xxxxxx>
> ---
> v2: use PTRACE_GETREGS64/PTRACE_SETREGS64 and the uapi struct pt_regs
> instead of a locally defined NT_PRSTATUS regset layout, as
> suggested by Kees Cook. Note the historical %g0 omission in that
> layout, which shifts the u_regs indices by one.

Thanks for this cleanup!

Yes, please feel free to take this through your tree.

Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

-Kees

--
Kees Cook