mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Stian Halseth <stian@itx.no>
Cc: Andreas Larsson <andreas@gaisler.com>,
	"David S . Miller" <davem@davemloft.net>,
	sparclinux@vger.kernel.org, Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>, Oleg Nesterov <oleg@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH v2 2/2] selftests/seccomp: add sparc64 support
Date: Fri, 9 Oct 2026 00:35:06 -0700	[thread overview]
Message-ID: <202610090034.BD0FB41CB@keescook> (raw)
In-Reply-To: <20260902072745.3412940-3-stian@itx.no>

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@itx.no>
> ---
> 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@kernel.org>

-Kees

-- 
Kees Cook

  reply	other threads:[~2026-10-09  7:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  7:27 [PATCH v2 0/2] sparc64: add seccomp filter support Stian Halseth
2026-09-02  7:27 ` [PATCH v2 1/2] " Stian Halseth
2026-09-02  7:27 ` [PATCH v2 2/2] selftests/seccomp: add sparc64 support Stian Halseth
2026-10-09  7:35   ` Kees Cook [this message]
2026-10-07  6:14 ` [PATCH v2 0/2] sparc64: add seccomp filter support Andreas Larsson
2026-10-09  6:55   ` John Paul Adrian Glaubitz
2026-10-09 14:32 ` Andreas Larsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610090034.BD0FB41CB@keescook \
    --to=kees@kernel.org \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=shuah@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=stian@itx.no \
    --cc=wad@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®