Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
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: [RFC PATCH] s390/syscall: Sign extend system call number retrieved via syscall_get_nr()
Date: Thu, 22 Oct 2026 09:56:46 +0200	[thread overview]
Message-ID: <20261022075646.11120A92-hca@linux.ibm.com> (raw)
In-Reply-To: <sashiko-outbox-180303@kernel.org>

On Wed, Oct 21, 2026 at 01:27:30PM +0000, sashiko-bot@kernel.org wrote:
> > @@ -20,7 +20,7 @@ static inline long syscall_get_nr(struct task_struct *task,
> >  				  struct pt_regs *regs)
> >  {
> >  	return test_pt_regs_flag(regs, PIF_SYSCALL) ?
> > -		(regs->int_code & 0xffff) : -1;
> > +		(s16)(regs->int_code & 0xffff) : -1;
> >  }
> 
> [Severity: High]
> When a system call is skipped under SECCOMP_RET_TRACE on s390, can this cause
> __do_syscall() to return the wrong value to userspace instead of -ENOSYS?
> 
> Previously, syscall_get_nr() returned an unsigned 16-bit value (65535 when nr
> was set to -1), so after PTRACE_EVENT_SECCOMP in
> kernel/seccomp.c:__seccomp_filter():
> 
> 	/* Check if the tracer forced the syscall to be skipped. */
> 	this_syscall = syscall_get_nr(current, current_pt_regs());
> 	if (this_syscall < 0)
> 		goto skip;

This is addressed with:
https://lore.kernel.org/all/20261021085643.2442949-1-hca@linux.ibm.com/

Read: should not happen anymore.

> [Severity: Medium]
> Should arch/s390/kernel/syscall.c:__do_syscall() and
> arch/s390/include/asm/syscall.h:syscall_set_nr() also be updated to keep the
> syscall number representation consistent with syscall_get_nr()?
> 
> In arch/s390/kernel/syscall.c:__do_syscall():
> 
> 	nr = regs->int_code & 0xffff;
> 	if (likely(!nr)) {
> 		nr = regs->gprs[1] & 0xffff;
> 		regs->int_code &= ~0xffffUL;
> 		regs->int_code |= nr;
> 	}
> 	regs->gprs[2] = nr;

This is valid - things should be consistent.

      reply	other threads:[~2026-10-22  7:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 12:59 [RFC PATCH] s390/syscall: Sign extend system call number retrieved via syscall_get_nr() Heiko Carstens
2026-10-21 13:27 ` sashiko-bot
2026-10-22  7:56   ` Heiko Carstens [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=20261022075646.11120A92-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@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