Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 175CF47887B for ; Thu, 13 Aug 2026 13:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786629052; cv=none; b=dOOUK0qlAZlNJJcJuL6C7br1SH4VIh3xutTAGfOsL2Phlq39Yw+yJMcq5ed3Q1XpFK7NOh6vZ3ZPFfnCa/UOF9fkMpt5p/PEyxlSMGkjZ6zlkvjoN/BvZSJzaAhU4g1P+Tz515PaW3Aap/zBmsI6mdXwYKW4bMD7ICIuVUHJqyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786629052; c=relaxed/simple; bh=xQ6tqhHzKPvrB3M0kximisa0w8UvzwCclFNK3oAhpZ0=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=A7eoJlRMKnB1XsMsJFTe8BXqtJcGLjwBnBaT79EzAYAN1/faHZGBh152+v/XWymNHE1dcgMCyy9cnn3OJmukDLqvYYmO+bJH6sSc8RydrMMBlwUGVNU2ah5e1096Ec0QjRRifjyQPeVGEauY0jvrxeLS2vxMjN8pp+ZquOujVX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y05JX93F; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y05JX93F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B51391F000E9; Thu, 13 Aug 2026 13:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786629050; bh=QXwyosYmdTY1QBRYmGMtdw1m22drvuAPxxccJCIZ6G4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Y05JX93FWXpcgPPtvNYakTdKN2Gg0u7eNDPBZip4UBkE5EUMxgOk0uVC20LYUmg2y WaxESb2Rp90wZ0AeIBrQ182Rji+ON9eJWppFr8ZfcIeeax1YyWx4jvK2wkCSVgNZgT MBGhRiI3c9kE3wdYrqgUxOhR6Zu7qNUreIqV1zJ6pd+0mYgXLuIYNIx/3aGnTB6zgL uDSLG9b7iOHJEfu6DOdSOXfrhq68aLN6lrQtdmUc/QoMq+Y5TtMQUIfE/9hldJFc3O 6zj1Rm7g/7mFZRG+ncYTtW57miPyQBjhpbEv8O+0JH8XGVrsD4tfy8VVYkg26+IWdF Zbmk5DnXQsyQw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wuVpY-0000000FLem-3MfH; Thu, 13 Aug 2026 13:50:48 +0000 Date: Thu, 13 Aug 2026 14:50:48 +0100 Message-ID: <864igy164n.wl-maz@kernel.org> From: Marc Zyngier To: Will Deacon Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Oliver Upton Subject: Re: [PATCH] KVM: arm64: Avoid mismatched accesses to 'struct kvm_nvhe_init_params' In-Reply-To: <20260813131717.5885-1-will@kernel.org> References: <20260813131717.5885-1-will@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: will@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oupton@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 13 Aug 2026 14:17:16 +0100, Will Deacon 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 > Cc: Marc Zyngier > Fixes: afa9b48f327c ("KVM: arm64: Shave a few bytes from the EL2 idmap code") > Signed-off-by: Will Deacon Oh hum... That's a nice one. Thanks for getting to the bottom of it. FWIW: Reviewed-by: Marc Zyngier Cc: stable@vger.kernel.org M. -- Without deviation from the norm, progress is not possible.