mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/extable: Fix mvcos instruction decoding
Date: Mon, 12 Oct 2026 08:38:59 +0200	[thread overview]
Message-ID: <yt9d33ub2zjw.fsf@linux.ibm.com> (raw)
In-Reply-To: <20261002102750.1994830-1-hca@linux.ibm.com> (Heiko Carstens's message of "Fri, 2 Oct 2026 12:27:50 +0200")

Heiko Carstens <hca@linux.ibm.com> writes:

> If either the b1 or b2 field of the mvcos instruction is zero, register
> zero is not used for address computation; zero is used instead, according
> to the architecture. ex_handler_ua_mvcos() incorrectly uses the real
> contents of register zero. Fix this.
>
> This shouldn't be a problem for any generated code, since the compiler
> would only generate such code if it is possible to prove at compile time
> that either the source or destination address is within the first 4kb of
> the designated address space. Such code should not exist (also confirmed
> by an allyesconfig build and decoding all ~7000 mvcos instructions).
>
> Fixes: c488f5187a24 ("s390/uaccess: Shorten raw_copy_from_user() / raw_copy_to_user() inline assemblies")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/mm/extable.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/mm/extable.c b/arch/s390/mm/extable.c
> index 7498e858c401..848855da9a70 100644
> --- a/arch/s390/mm/extable.c
> +++ b/arch/s390/mm/extable.c
> @@ -106,9 +106,9 @@ static bool ex_handler_ua_mvcos(const struct exception_table_entry *ex,
>  	regs->psw.addr = extable_fixup(ex);
>  	insn = (struct insn_ssf *)regs->psw.addr;
>  	if (from)
> -		uaddr = regs->gprs[insn->b2] + insn->d2;
> +		uaddr = (insn->b2 ? regs->gprs[insn->b2] : 0) + insn->d2;
>  	else
> -		uaddr = regs->gprs[insn->b1] + insn->d1;
> +		uaddr = (insn->b1 ? regs->gprs[insn->b1] : 0) + insn->d1;
>  	remainder = PAGE_SIZE - (uaddr & (PAGE_SIZE - 1));
>  	if (regs->gprs[insn->r3] <= remainder)
>  		remainder = 0;

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>

      reply	other threads:[~2026-10-12  6:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 10:27 Heiko Carstens
2026-10-12  6:38 ` Sven Schnelle [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=yt9d33ub2zjw.fsf@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.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®