From: Marc Zyngier <maz@kernel.org>
To: Keir Fraser <keirf@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Kristina Martsenko <kristina.martsenko@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Will Deacon <will@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] arm64: mops: Do not dereference src reg for a set operation
Date: Wed, 26 Mar 2025 09:39:22 +0000 [thread overview]
Message-ID: <86zfh8ku5x.wl-maz@kernel.org> (raw)
In-Reply-To: <20250326070255.2567981-1-keirf@google.com>
On Wed, 26 Mar 2025 07:02:55 +0000,
Keir Fraser <keirf@google.com> wrote:
>
> The register is not defined and reading it can result in a UBSAN
> out-of-bounds array access error, specifically when the srcreg field
> value is 31.
Gah, XZR/SP encoding strikes back...
>
> Cc: Kristina Martsenko <kristina.martsenko@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: stable@vger.kernel.org
> Signed-off-by: Keir Fraser <keirf@google.com>
> ---
> arch/arm64/include/asm/traps.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
> index d780d1bd2eac..82cf1f879c61 100644
> --- a/arch/arm64/include/asm/traps.h
> +++ b/arch/arm64/include/asm/traps.h
> @@ -109,10 +109,9 @@ static inline void arm64_mops_reset_regs(struct user_pt_regs *regs, unsigned lon
> int dstreg = ESR_ELx_MOPS_ISS_DESTREG(esr);
> int srcreg = ESR_ELx_MOPS_ISS_SRCREG(esr);
> int sizereg = ESR_ELx_MOPS_ISS_SIZEREG(esr);
> - unsigned long dst, src, size;
> + unsigned long dst, size;
>
> dst = regs->regs[dstreg];
> - src = regs->regs[srcreg];
> size = regs->regs[sizereg];
>
> /*
> @@ -129,6 +128,7 @@ static inline void arm64_mops_reset_regs(struct user_pt_regs *regs, unsigned lon
> }
> } else {
> /* CPY* instruction */
> + unsigned long src = regs->regs[srcreg];
> if (!(option_a ^ wrong_option)) {
> /* Format is from Option B */
> if (regs->pstate & PSR_N_BIT) {
Reviewed-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-03-26 9:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 7:02 [PATCH] arm64: mops: Do not dereference src reg for a set operation Keir Fraser
2025-03-26 9:39 ` Marc Zyngier [this message]
2025-03-26 10:26 ` Mark Rutland
2025-03-26 10:45 ` Keir Fraser
-- strict thread matches above, loose matches on Subject: below --
2025-03-26 11:00 Keir Fraser
2025-03-26 11:05 ` Mark Rutland
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=86zfh8ku5x.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=keirf@google.com \
--cc=kristina.martsenko@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=stable@vger.kernel.org \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).