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 1EE09CD6E45 for ; Fri, 29 May 2026 08:15:15 +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=vISZXmW7d64JDmjfGiO5dCpQmHuaFYKlaeIq42DDx9I=; b=bHrsmXoqqCF5tfIfvbxMiMYs5i y2WgFe4sN/1+dhvJ64yXiCpzjhwRLSCt2N2Osubn0pl6OkpfeMogSnWMOjvRgRwdIy9Y14cnCi24J lDBiF1kfFGA7lfBZmAEi6UBenieVDPn28s/7+AEmNdKo3Fks6Bs1rAk4oKQ3aueV09b5myOKIaIh2 1TbP3mbinWSVQRLbzjD3hsP22nUi9eUj51CWLVfkML1g6GwbM2qBpdyIijZPioT9pQ1G7WYGUf3/H JLpFi/vOIED5hIRHOu1lo4yo/avDbYeKig2tivhsK7IL7KLCIYC8rTypDc6wNU7LtugPbcahDy1qT qVPfIU7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wSsN3-00000006wL9-0P80; Fri, 29 May 2026 08:15:09 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wSsN1-00000006wKz-3UPu for linux-arm-kernel@lists.infradead.org; Fri, 29 May 2026 08:15:07 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id EFB8C60564; Fri, 29 May 2026 08:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A58C01F00893; Fri, 29 May 2026 08:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780042506; bh=vISZXmW7d64JDmjfGiO5dCpQmHuaFYKlaeIq42DDx9I=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=LknxlMJlmPTMlZtMw37pza5r1lI44t+USBpbe35WV6NrhHSAXui2pTx8PpPo1SoXi Y6f6m5HPX0+JoKxtH+sd1BrqST1tCjMBXJ7tMde7+lMrzEqn8rx9Q/35/jaJes/i1u 5ibB/hbSLQ8uuEDGTO3fWvL/REcRMJc9tYF2sm46C5fSO1ok5EUx11LGFVUAYF62K1 WKWPs+ZUg/MDLHciVrVMtC6iWZsJngWC00mV5Dg2uYWc4yePw8vm54W+goaNBem6es mVZJMGR6naZMsVBecO4G6QRI2yN2lKFSvnLmyP287YbQG5kUcl1ReozJbLJt8u3XUf SVtjg849lB/Tw== 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 1wSsMy-00000007KAi-2XBz; Fri, 29 May 2026 08:15:04 +0000 Date: Fri, 29 May 2026 09:15:04 +0100 Message-ID: <86a4tivdh3.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Vincent Donnefort , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Quentin Perret , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] KVM: arm64: Fix host/hyp tracking on share/unshare hypercall failure In-Reply-To: References: <20260529074341.2271950-1-tabba@google.com> 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: tabba@google.com, vdonnefort@google.com, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, qperret@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org 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 Fri, 29 May 2026 09:05:35 +0100, Fuad Tabba wrote: > > On Fri, 29 May 2026 at 09:02, Vincent Donnefort wrote: > > > > On Fri, May 29, 2026 at 08:43:39AM +0100, tabba@google.com wrote: > > > Hi folks, > > > > > > Yet another bug I found while testing Sashiko locally with fixes to > > > review-prompts. > > > > > > share_pfn_hyp() and unshare_pfn_hyp() in arch/arm64/kvm/mmu.c > > > maintain a host-side RB-tree mirroring the set of pages shared with > > > EL2. Both invoke a hypercall that can fail (page-state mismatch, > > > EL2 refcount still held), but neither cleans up on failure: > > > > > > - share_pfn_hyp() inserts the tracking node before the hypercall > > > and leaves it in the tree on failure, leaking the allocation and > > > presenting a phantom share to a later unshare. > > > > > > - unshare_pfn_hyp() erases the tracking node before the hypercall; > > > on failure the host loses its record while EL2 still owns the > > > share, breaking later operations on the same pfn. > > > > > > Severity is low (no isolation impact) and the failure paths are rare > > > in practice, but the desync is real. Both patches are independent and > > > apply cleanly to current mainline. In other words, this can wait for > > > 7.2. > > > > > > I believe I fixed that here lore.kernel.org/all/acyKhZL2di_QQ9xm@google.com but > > as Quentin pointed-out, there's absolutely no reason for the hypercall to fail. > > So I haven't sent a v2. > > At the very least we need to add a comment, otherwise, people like me > and LLMs like Sashiko would stumble upon it. > > That said, this fix adds no real overhead, makes the code clearer, and > guards us against a future where that call might fail. > Self-documenting in essense. > > WDYT? If a hypercall really cannot fail, why does it have a return value? M. -- Without deviation from the norm, progress is not possible.