Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Heiko Carstens" <hca@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH] s390/syscall: Set -ENOSYS return value before calling syscall_enter_from_user_mode_work()
Date: Wed, 21 Oct 2026 09:09:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-180011@kernel.org> (raw)
In-Reply-To: <20261021085643.2442949-1-hca@linux.ibm.com>

> On s390 gpr2 contains both the system call return value and the system call
> number. With [1] it is expected to set gpr2 to -ENOSYS before calling
> syscall_enter_from_user_mode_work(), so that a skipped system call has a
> defined default return value, and not the system call number like today.
> 
> To make that work and stay compatible with existing ptrace users, replace
> PIF_SYSCALL_RET_SET with PIF_SYSCALL_ENTRY. PIF_SYSCALL_ENTRY is set before
> syscall_enter_from_user_mode_work() is called and indicates that reads and
> writes to gpr2 via PTRACE_PEEKUSR, PTRACE_POKEUSR, PTRACE_GETREGSET, and
> PTRACE_SETREGSET are redirected to regs->int_code, which contains the
> system call number. gpr2, which contains the system call return value, can
> only be changed via syscall_set_return_value() (e.g. seccomp).
> 
> After syscall_enter_from_user_mode_work() returns, PIF_SYSCALL_ENTRY is
> cleared and the code behaves as before.
> 
> PIF_SYSCALL_RET_SET was introduced with [2]. The flag was set by
> syscall_set_return_value() and allowed seccomp to skip syscalls
> and inject a return value despite the gpr2 aliasing.
> 
> Kernel seccomp and ptrace selftests, as well as strace selftests, show no
> difference with and without this change.
> 
> [1] 05c033db7e9a ("entry, treewide: Make syscall_enter_from_user_mode[_work]() indicate syscall execution")
> [2] 56e62a737028 ("s390: convert to generic entry")
> 
> Fixes: 05c033db7e9a ("entry, treewide: Make syscall_enter_from_user_mode[_work]() indicate syscall execution")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261021085643.2442949-1-hca@linux.ibm.com?part=1


      reply	other threads:[~2026-10-21  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  8:56 [PATCH] s390/syscall: Set -ENOSYS return value before calling syscall_enter_from_user_mode_work() Heiko Carstens
2026-10-21  9:09 ` sashiko-bot [this message]

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=sashiko-outbox-180011@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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