From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6244D23A6 for ; Fri, 21 Apr 2023 09:12:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12D06C433EF; Fri, 21 Apr 2023 09:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682068371; bh=BqI/r9fxQX3I0XSqlp5999mBotQQlkEXQJiwJzvCCU4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nFysCOrRfFXPjA6CIuX5hJnkWrvl9q8pXefKw6FGs43Bvlcf3HlXyPqwp7KqnAQFc pzzjGyq1NphoolyWoCoEpWCgrvBIQJCBX0uoR50mhoaYGlLk+sLdOfoYVaELwIXuL2 jbDtXplQWPSZZAwA4bRgOgwXjmYfNWftxV2ZHi9Z7+t9PNc0FLo3g7h9R7qM6lUhYk 83cwMJ4uDTspSUj7Zsw6xy24VpcwGCL89nUOdmY3s50L9RIpQO3Xweg7a6kT6jHmLJ 5NG58ntr4eS/sYIpRUQoHl+g5402cN9u9Qt+sQzoo00JTkQyNKyu1sDvyff6XP+j4B WcG2zLNw8AbZQ== 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.95) (envelope-from ) id 1ppmoy-00A7Sy-Ku; Fri, 21 Apr 2023 10:12:48 +0100 Date: Fri, 21 Apr 2023 10:12:48 +0100 Message-ID: <86sfctk38v.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, James Morse , Suzuki K Poulose , Zenghui Yu , David Matlack , Reiji Watanabe Subject: Re: [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 In-Reply-To: <20230421071606.1603916-1-oliver.upton@linux.dev> References: <20230421071606.1603916-1-oliver.upton@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/28.2 (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: oliver.upton@linux.dev, kvmarm@lists.linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, dmatlack@google.com, reijiw@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 21 Apr 2023 08:16:04 +0100, Oliver Upton wrote: > > Ugh. > > So it appears that there is a race between two parallel stage-2 map > walkers that could lead to mapping the incorrect PA for a given IPA, as > the IPA -> PA relationship picks up an unintended offset. This series > eliminates the problem by using the current IPA of the walk as the > source-of-truth regarding where we are in a map operation. If you're > curious about the race, it is spelled out in the first patch. Ugh indeed. > > While there is no such race to update hyp's stage-1, the second patch > applies the same rationale to hyp stage-1 walks for the sake of > consistency. > > Applies to 6.3-rc3, and merges w/o conflict into kvmarm/next. Took this > for a ride with selftests, kvm-unit-tests, QEMU, and our internal VMM > (affectionately referred to as Vanadium on the list from time to time). > I also ran through the gamut of nVHE, VHE, and pKVM given the effects on > hyp stage-1. > > Marc, the bug can have some rather ugly (albeit rare) consequences, so > I'd like to get this in ASAP. The door is shut on 6.3, but it'd be nice > to squeeze in the 6.4 pull request if possible. This is a pretty invasive change, and I'd really like to give it some -next exposure. I'm not doubting your testing, but experience shows that there is always someone with a more tricky setup... What I'd suggest is to not include it in the pull request that I'm about to send today, but to let it simmer in -next for a week. This will give us some confidence that we're OK, and also avoid being shouted at for sending stuff that hasn't been in -next at all. If everything checks out after a week, I'll send another PR with this fix (and whatever will have landed in the meantime). Would that work for you? M. -- Without deviation from the norm, progress is not possible.