From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932169AbbIUPUE (ORCPT ); Mon, 21 Sep 2015 11:20:04 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:36542 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbbIUPUB (ORCPT ); Mon, 21 Sep 2015 11:20:01 -0400 Subject: Re: include/linux/kvm_host.h:488 suspicious rcu_dereference_check() usage! To: Borislav Petkov References: <20150920164851.GB3540@pd.tnic> <56001DF6.3000902@redhat.com> Cc: kvm ML , lkml , Xiao Guangrong From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <5600201D.8050700@redhat.com> Date: Mon, 21 Sep 2015 17:19:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56001DF6.3000902@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/09/2015 17:10, Paolo Bonzini wrote: > > > On 20/09/2015 18:48, Borislav Petkov wrote: >> [26421.593927] ------ spte 0x3e5a22027 level 4. >> [26421.598228] ------ spte 0x38a00b027 level 3. >> [26421.602505] ------ spte 0x387334027 level 2. >> [26421.602506] ------ spte 0xffff0000000b8f67 level 1. >> [26421.602506] ------------[ cut here ]------------ >> [26421.602530] WARNING: CPU: 2 PID: 17000 at arch/x86/kvm/mmu.c:3385 handle_mmio_page_fault.part.93+0x1a/0x20 [kvm]() >> [26421.602550] Modules linked in: tun sha256_ssse3 sha256_generic drbg binfmt_misc ipv6 vfat fat fuse dm_crypt dm_mod kvm_amd kvm crc32_pclmul aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd fam15h_power amd64_edac_mod k10temp edac_core amdkfd amd_iommu_v2 radeon acpi_cpufreq >> [26421.602552] CPU: 2 PID: 17000 Comm: qemu-system-i38 Not tainted 4.3.0-rc1+ #1 >> [26421.602553] Hardware name: To be filled by O.E.M. To be filled by O.E.M./M5A97 EVO R2.0, BIOS 1503 01/16/2013 >> [26421.602555] ffffffffa02fc7d2 ffff880386c0fb80 ffffffff812c8c2a 0000000000000000 >> [26421.602556] ffff880386c0fbb8 ffffffff81053e55 ffff880429ff8000 000000000000000f >> [26421.602558] 00000000000b8000 0000000000000000 00000000ffffffff ffff880386c0fbc8 >> [26421.602558] Call Trace: >> [26421.602564] [] dump_stack+0x4e/0x84 >> [26421.602566] [] warn_slowpath_common+0x95/0xe0 >> [26421.602567] [] warn_slowpath_null+0x1a/0x20 >> [26421.602577] [] handle_mmio_page_fault.part.93+0x1a/0x20 [kvm] > > Can you test this patch for this second call trace? > > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index fb16a8ea3dee..10c281ec9a25 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -3320,6 +3320,9 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) > if (!is_shadow_present_pte(spte)) > break; > > + if (leaf == 1 && is_mmio_spte(spte)) > + break; > + > reserved |= is_shadow_zero_bits_set(&vcpu->arch.mmu, spte, > leaf); > } And of course I need a v2 of this one too. :( First, the leaf test would have to be == 0, because I prepared the patch on the first 4.3 pull request instead of the latest Linus tree. However even this would not be a good change, because is_shadow_present_pte(spte) == !(pte & PT_PRESENT_MASK) || is_mmio_spte(pte) and thus is_shadow_present_pte implies the "if" I'm adding above. So can you instead please add this debugging printk? diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index fb16a8ea3dee..90e8ef264861 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3334,6 +3334,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) sptes[root - 1], root); root--; } + pr_err("shadow_mmio_mask: %lx\n", shadow_mmio_mask); } exit: *sptep = spte; Paolo