Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340707 > unrolled thread

Re: kvm: using uninitialized var in tdp_page_fault

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-02-23 15:40 +0100
Last post2016-02-28 14:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: kvm: using uninitialized var in tdp_page_fault Paolo Bonzini <pbonzini@redhat.com> - 2016-02-23 15:40 +0100
    Re: kvm: using uninitialized var in tdp_page_fault Dmitry Vyukov <dvyukov@google.com> - 2016-02-28 14:10 +0100

#1340707 — Re: kvm: using uninitialized var in tdp_page_fault

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-02-23 15:40 +0100
SubjectRe: kvm: using uninitialized var in tdp_page_fault
Message-ID<r5mi7-6Kg-45@gated-at.bofh.it>

On 15/01/2016 18:02, Sasha Levin wrote:
> Hi all,
> 
> While fuzzing with syzkaller on the latest -next kernel running on a KVM tools
> guest, I've hit the following use of an uninitialized variable:
> 
> [  810.783676] UBSAN: Undefined behaviour in arch/x86/kvm/mmu.c:3502:6
> 
> [  810.785650] load of value 179 is not a valid value for type '_Bool'

Can you check this patch:

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index be3cef12706c..fd54613a1204 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1449,8 +1449,11 @@ pfn_t __gfn_to_pfn_memslot(struct
 	if (addr == KVM_HVA_ERR_RO_BAD)
 		return KVM_PFN_ERR_RO_FAULT;
 
-	if (kvm_is_error_hva(addr))
+	if (kvm_is_error_hva(addr)) {
+		if (writable)
+			*writable = false;
 		return KVM_PFN_NOSLOT;
+	}
 
 	/* Do not map writable pfn in the readonly memslot. */
 	if (writable && memslot_is_readonly(slot)) {

Thanks,

Paolo

[toc] | [next] | [standalone]


#1345242

FromDmitry Vyukov <dvyukov@google.com>
Date2016-02-28 14:10 +0100
Message-ID<r79gK-2KG-13@gated-at.bofh.it>
In reply to#1340707
On Tue, Feb 23, 2016 at 3:30 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 15/01/2016 18:02, Sasha Levin wrote:
>> Hi all,
>>
>> While fuzzing with syzkaller on the latest -next kernel running on a KVM tools
>> guest, I've hit the following use of an uninitialized variable:
>>
>> [  810.783676] UBSAN: Undefined behaviour in arch/x86/kvm/mmu.c:3502:6
>>
>> [  810.785650] load of value 179 is not a valid value for type '_Bool'
>
> Can you check this patch:
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index be3cef12706c..fd54613a1204 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1449,8 +1449,11 @@ pfn_t __gfn_to_pfn_memslot(struct
>         if (addr == KVM_HVA_ERR_RO_BAD)
>                 return KVM_PFN_ERR_RO_FAULT;
>
> -       if (kvm_is_error_hva(addr))
> +       if (kvm_is_error_hva(addr)) {
> +               if (writable)
> +                       *writable = false;
>                 return KVM_PFN_NOSLOT;
> +       }
>
>         /* Do not map writable pfn in the readonly memslot. */
>         if (writable && memslot_is_readonly(slot)) {



Sasha, does it fix the issue? This patch is still not merged.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web