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 645F0C6FD19 for ; Mon, 13 Mar 2023 09:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=r7W0zvFOHphXphcrAI11gPtf6xkqd2Vrw6IVh6Myy3I=; b=smtL/FLJWixbSg il0KKlaRMltAYBgPx+tkaL6fn5EpA9zB8lLpstk1PjYVqVS5pb5gUYH/HKFB5quYhGD4K1ESie5Wa OIJofsRa7CTdFF4vmP242I3LMbw7pJciG10PRu8ibhse+ZwN3d2h9YcAdYvgOSGzAZvzusGLTzOSB r4CubJvFiskFlns4qJHsQgiW4OrmnAGaoQytBgPGgZo0mil2SmDZhIEbF7T/+D39SPhZdYAOQ2jAN YbjdVhHkhkNYJeSYhunjJrtP32Yqpk3eEyNaKfwT11jI58pLwZvSa5H3H7eRAwFfiyNxYaCXGOlA4 Q8zo6QQMWYJUzGWkskYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbeGx-004wY3-SG; Mon, 13 Mar 2023 09:15:15 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbeGd-004wT1-5o for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 09:14:59 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3E585CE0A1F; Mon, 13 Mar 2023 09:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 700F8C433EF; Mon, 13 Mar 2023 09:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678698890; bh=Y0XLnrqcdiNHMLsFp+Z7PoEjpZ9/TLl3jHTZFQx/TeQ=; h=From:To:Cc:Subject:Date:From; b=dImEaMhdnkFCElHYxdgTRzpHGc5sv3oktR3lcRF7Gd+lnzAR0/05//STbIteu2YnW jnaRUopN+/NImNrVI9K9X0PDCsQuZ4xVnLtrv8o7GMaM5vV8cBS2dwwt6jNGnMEqa5 In1D4GgVR2UATTQqSM0dTuM4NfqsuCnJ2SLSoXC+CHq7i3JfT/pgsD7YLXuxZNCkhY 84cdqft7RNP2J3nPK95eDdYjkp5W36wCX93rALJ5U+uEN1j9rSHhpIQVm1uOrSDUv1 c7ca2xoVyv+nj9ABchE98hlNsGwWoy8AkfT+YQSkJNBG91FF4BSf3kqVinre96VBDP N+D5VFIgE/YEQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pbeGW-00HAzq-2m; Mon, 13 Mar 2023 09:14:48 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Ard Biesheuvel , Will Deacon , Quentin Perret Subject: [PATCH 0/2] KVM: arm64: Plug a couple of MM races Date: Mon, 13 Mar 2023 09:14:23 +0000 Message-Id: <20230313091425.1962708-1-maz@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, ardb@kernel.org, will@kernel.org, qperret@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_021455_468915_A215147E X-CRM114-Status: GOOD ( 14.40 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ard recently reported a really odd warning generated with KASAN, where the page table walker we use to inspect the userspace page tables was going into the weeds and accessing something that was looking totally unrelated (and previously freed). Will and I spent quite some time looking into it, and while we were not able to reproduce the issue, we were able to spot at least a couple of issues that could partially explain the issue. The first course of action is to disable interrupts while walking the userspace PTs. This prevents exit_mmap() from tearing down these PTs by blocking the IPI. We also fail gracefully if the IPI won the race and killed the page tables before we started the walk. The second issue is to not use a VMA pointer that was obtained with the mmap_read_lock held after that lock has been released. There is no guarantee that it is still valid. I've earmarked both for stable, though I expect backporting this to older revisions of the kernel could be... interesting. M. Marc Zyngier (2): KVM: arm64: Disable interrupts while walking userspace PTs KVM: arm64: Check for kvm_vma_mte_allowed in the critical section arch/arm64/kvm/mmu.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel