Re: [PATCH] KVM: arm64: Avoid mismatched accesses to 'struct kvm_nvhe_init_params'

Marc Zyngier <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel
Message-ID <[email protected]>
On Thu, 13 Aug 2026 14:17:16 +0100,
Will Deacon <[email protected]> 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 <[email protected]>
> Cc: Marc Zyngier <[email protected]>
> Fixes: afa9b48f327c ("KVM: arm64: Shave a few bytes from the EL2 idmap code")
> Signed-off-by: Will Deacon <[email protected]>

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

FWIW:

Reviewed-by: Marc Zyngier <[email protected]>
Cc: [email protected]

	M.

-- 
Without deviation from the norm, progress is not possible.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.