From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E4CEFD876B for ; Tue, 17 Mar 2026 13:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mYXoHgOnqzH4HBKsdPzNNq/jGXF4Z35IdiG56QCuC1k=; b=EUGSsDc9H2H5TSf+jD8aozz1NX KSrFV0INbPcy7+6ApzifRGb7cwijMXWI+XmwwDyCWLG+I/13/b59F7upkYnv+C9QCLU2vuuivtbEV t9e1P+lkeHY6Ri417gXTUtieY2nHvSsAshLxzp7TpObJHseMxXaR1nc9sk2xRQ6uSbxf3X3tikCah pmtfeyqT16Bla3JUG7KQi8puhKlEERS47KIZ7HaLrNg2gM2HVpZPIpczufebR9y/uFkpxkN+KRtB3 tTVlN52qprjT6j0J1YY3daMtHUwZyaRe9sYBSa92vEM2ReQ3uTjaETyJyYqUr52ieIsD8QSmYOxm9 m3jzfCvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w2UcU-00000006Sft-3Ki8; Tue, 17 Mar 2026 13:38:02 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w2UcT-00000006Sfi-1f8z for linux-arm-kernel@lists.infradead.org; Tue, 17 Mar 2026 13:38:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 83B0060008; Tue, 17 Mar 2026 13:38:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21517C4CEF7; Tue, 17 Mar 2026 13:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773754680; bh=XiXn41pL2mt6VJb+KOB6yO3Ib6UpJH/uxeyyDCOxJyA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fuE6DjED9CTPH8f9EXRTnRTf+rL+QXqdh0zK/bCJDqNAYrUxe4dNcEF2shjsFq5iV vTM0nQdqhRnTTFP9Ja4W4treexcNeA/7O9w1OhLmS+4oeeMehhvP3qxPrJJ+hiDrMC /MQbI/XOs50gqNUzauoTyiGTGViQRMUaLdprVMnyJ+6Qx3hprQ8qg+JthEE+AOq9Ke kI3HFyN48wY0HqBwVkS4sIe1t+XsmmrZiwMuD3lwRXxD32Dsb3nyZrZCvgXHBSbmYe QiicapWWTa8oXvF0jX+DBKCH9HqUYp9JRNSdpZFRODJN7HYyezisCb0px9zcEWOOgn 7HckbnmP4F6jA== 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 1w2UcQ-00000002rPw-0DDo; Tue, 17 Mar 2026 13:37:58 +0000 Date: Tue, 17 Mar 2026 13:37:57 +0000 Message-ID: <86ldfq60ga.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com Subject: Re: [PATCH] KVM: arm64: Fix the descriptor address in __kvm_at_swap_desc() In-Reply-To: <20260317115748.47332-1-zenghui.yu@linux.dev> References: <20260317115748.47332-1-zenghui.yu@linux.dev> 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) 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: zenghui.yu@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 17 Mar 2026 11:57:48 +0000, Zenghui Yu wrote: > > From: "Zenghui Yu (Huawei)" > > Using "(u64 __user *)hva + offset" to get the virtual addresses of S1/S2 > descriptors looks really wrong, if offset is not zero. What we want to get > for swapping is hva + offset, not hva + offset*8. ;-) > > Fix it. > > Fixes: f6927b41d573 ("KVM: arm64: Add helper for swapping guest descriptor") > Signed-off-by: Zenghui Yu (Huawei) > --- > arch/arm64/kvm/at.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c > index c5c5644b1878..a024d9a770dc 100644 > --- a/arch/arm64/kvm/at.c > +++ b/arch/arm64/kvm/at.c > @@ -1753,7 +1753,7 @@ int __kvm_at_swap_desc(struct kvm *kvm, gpa_t ipa, u64 old, u64 new) > if (!writable) > return -EPERM; > > - ptep = (u64 __user *)hva + offset; > + ptep = (void __user *)hva + offset; > if (cpus_have_final_cap(ARM64_HAS_LSE_ATOMICS)) > r = __lse_swap_desc(ptep, old, new); > else Holy crap! How did we miss that??? Thanks a lot for spotting it, I'll queue that now. M. -- Without deviation from the norm, progress is not possible.