From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Fedin Subject: RE: [PATCH] KVM: arm: Fix crash in free_hyp_pgds() if timer initialization fails Date: Fri, 06 Nov 2015 16:43:56 +0300 Message-ID: <006d01d11899$2f7932f0$8e6b98d0$@samsung.com> References: <1445931608-8824-1-git-send-email-p.fedin@samsung.com> <20151105152440.GF5819@cbox> <002601d11876$1bc3cf40$534b6dc0$@samsung.com> <20151106114223.GI5819@cbox> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, 'Marc Zyngier' To: 'Christoffer Dall' Return-path: Received: from mailout2.w1.samsung.com ([210.118.77.12]:46717 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161298AbbKFNoA (ORCPT ); Fri, 6 Nov 2015 08:44:00 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXE00304BHADU10@mailout2.w1.samsung.com> for kvm@vger.kernel.org; Fri, 06 Nov 2015 13:43:58 +0000 (GMT) In-reply-to: <20151106114223.GI5819@cbox> Content-language: ru Sender: kvm-owner@vger.kernel.org List-ID: Hello! > > > Did you check if PAGE_HYP_DEVICE can mean something sane on a stage-2 > > > page table entry and vice verse? > > > > I tried to, the chain of macros and variables is complicated enough not to > > get 200% sure, but anyway PAGE_HYP_DEVICE (as well as PAGE_S2_DEVICE) > > includes PROT_PTE_DEVICE, so this is definitely device. > > I even tried to construct some mask in order to make a single check for only > > DEVICE flags, but, to make things even less understandable and predictable, > > the same code with different bitfields is reused by ARM64. So, i thought that > > it will be more reliable just to add a second test. > > The thing I want to avoid is PAGE_HYP_DEVICE covering some normal S2 > mapping, which we *should* flush but that we now end up ignoring? That > doesn't sound like it can be the case because the device bit is the same > bit for both types of page tables, correct? Yes, this is exactly what i think. If DEVICE bit is set, then it's somehow device memory and it doesn't need flashing. Or, in order to be 200% sure, we could modify the whole unmapping logic to carry over a flag, telling whether we are removing normal or HYP mappings. But wouldn't this be much more complicated? Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia