All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Oliver Upton <oupton@kernel.org>
Subject: Re: [PATCH] KVM: arm64: Avoid mismatched accesses to 'struct kvm_nvhe_init_params'
Date: Thu, 13 Aug 2026 14:50:48 +0100	[thread overview]
Message-ID: <864igy164n.wl-maz@kernel.org> (raw)
In-Reply-To: <20260813131717.5885-1-will@kernel.org>

On Thu, 13 Aug 2026 14:17:16 +0100,
Will Deacon <will@kernel.org> wrote:
> 
> When running with hVHE enabled, ___kvm_hyp_init() calls
> __kvm_init_el2_state() on the CPU initialisation path during onlining
> and resume from suspend.
> 
> In order to avoid clobbering the link register across this call, it is
> stashed away in the 'tmp' member of 'struct kvm_nvhe_init_params',
> however this save/restore operation is performed with the stage-1 MMU
> disabled at EL2 and therefore gives rise to coherency problems because
> the field is not aligned or padded to the CWG. For example, a cacheable
> write to a physically-adjacent structure sharing the same cacheline
> could lead to an eviction and subsequent write-back, overwriting the
> saved LR while the incoming CPU is executing __kvm_init_el2_state().
> 
> Save the lr in far_el2 and remove the 'tmp' member from
> 'struct kvm_nvhe_init_params' altogether.
> 
> Cc: Oliver Upton <oupton@kernel.org>
> Cc: Marc Zyngier <maz@kernel.org>
> Fixes: afa9b48f327c ("KVM: arm64: Shave a few bytes from the EL2 idmap code")
> Signed-off-by: Will Deacon <will@kernel.org>

Oh hum... That's a nice one. Thanks for getting to the bottom of it.

FWIW:

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

	M.

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

      reply	other threads:[~2026-08-13 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 13:17 [PATCH] KVM: arm64: Avoid mismatched accesses to 'struct kvm_nvhe_init_params' Will Deacon
2026-08-13 13:50 ` 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=864igy164n.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=oupton@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.