The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: Oliver Upton <oupton@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Andre Przywara <andre.przywara@arm.com>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: arm64: Preserve GPRs for AArch32 CP64 reads generating an UNDEF
Date: Mon, 03 Aug 2026 07:32:29 +0100	[thread overview]
Message-ID: <868q6nd88y.wl-maz@kernel.org> (raw)
In-Reply-To: <20260802182222.2239-1-kmehltretter@gmail.com>

On Sun, 02 Aug 2026 19:22:22 +0100,
Karl Mehltretter <kmehltretter@gmail.com> wrote:
> 
> kvm_handle_cp_64() only seeds params.regval for writes. If a CP64 read is
> decoded but UNDEFs, emulate_cp() still returns handled and the caller
> writes params.regval back to Rt/Rt2.
> 
> This can happen for PMU counter read accesses generating an UNDEF. KVM
> injects the exception into the guest, so the MRRC GPRs must remain
> unchanged.
> 
> Instead, the uninitialised regval is copied into the guest GPRs. With stack
> auto-initialisation this is a deterministic zero or pattern value. With
> CONFIG_INIT_STACK_NONE it may be stale host stack data.
> 
> Match kvm_handle_cp_32() and kvm_handle_sys_reg() by seeding regval from
> the GPRs before emulation.
> 
> Fixes: 62a89c44954f0 ("arm64: KVM: 32bit handling of coprocessor traps")
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

      reply	other threads:[~2026-08-03  6:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 18:22 [PATCH v2] KVM: arm64: Preserve GPRs for AArch32 CP64 reads generating an UNDEF Karl Mehltretter
2026-08-03  6:32 ` Marc Zyngier [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=868q6nd88y.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=kmehltretter@gmail.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oupton@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --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