public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: kvm ML <kvm@vger.kernel.org>, lkml <linux-kernel@vger.kernel.org>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: Re: include/linux/kvm_host.h:488 suspicious rcu_dereference_check() usage!
Date: Mon, 21 Sep 2015 17:19:57 +0200	[thread overview]
Message-ID: <5600201D.8050700@redhat.com> (raw)
In-Reply-To: <56001DF6.3000902@redhat.com>



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]  [<ffffffff812c8c2a>] dump_stack+0x4e/0x84
>> [26421.602566]  [<ffffffff81053e55>] warn_slowpath_common+0x95/0xe0
>> [26421.602567]  [<ffffffff81053f5a>] warn_slowpath_null+0x1a/0x20
>> [26421.602577]  [<ffffffffa02cf73a>] 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

  reply	other threads:[~2015-09-21 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-20 16:48 include/linux/kvm_host.h:488 suspicious rcu_dereference_check() usage! Borislav Petkov
2015-09-21  5:48 ` Paolo Bonzini
2015-09-21 15:10 ` Paolo Bonzini
2015-09-21 15:19   ` Paolo Bonzini [this message]
2015-09-21 15:44     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5600201D.8050700@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox