public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Du Changbin <duchangbin3@huawei.com>,
	syzbot <syzbot+f9b42efadea9f5453100@syzkaller.appspotmail.com>
Cc: bp@alien8.de, hpa@zytor.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	rkrcmar@redhat.com, syzkaller-bugs@googlegroups.com,
	tglx@linutronix.de, x86@kernel.org, changbin.du@huawei.com,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: kernel BUG at arch/x86/kvm/x86.c:LINE! (2)
Date: Thu, 11 Oct 2018 16:32:28 +0200	[thread overview]
Message-ID: <44d8f927-85bb-cde5-1ddc-93da5ea048ae@redhat.com> (raw)
In-Reply-To: <c4d02cc1-0298-533d-bc07-bb4195c2eea9@huawei.com>

On 11/10/2018 04:57, Du Changbin wrote:
> I think the issue is that using vmx instructions after vmx off. The
> scenario is:
> 1. kernel is rebooting and vmx is turned off by notification handler
> kvm_reboot(),
>    and 'kvm_rebooting' is set.
> 2. But there is a pending KVM_CREATE_VCPU ioctl which will invoke
> vmcs_clear()->
>    ____kvm_handle_fault_on_reboot()->kvm_spurious_fault()->BUG().
> 
> Need to improve the handler for such case so won't hang kernel.

Why would the kernel be rebooting, given the reproducer (listed below my
signature, or at https://syzkaller.appspot.com/x/repro.c?x=131e37c9400000)?

I think this is a duplicate of

   WARNING: refcount bug in kvm_vm_ioctl
   BUG: unable to handle kernel paging request in
refcount_inc_not_zero_checked

In all cases the refcounts seem to be broken, and kvm_destroy_kvm is
called prematurely (which in this case results in hardware_disable_all
being called, so that the vmclear fails).

Dmitry, have such bugs been reported for subsystems other than KVM?

Paolo

#syz dup: WARNING: refcount bug in kvm_vm_ioctl

> # See https://goo.gl/kgGztJ for information about syzkaller reproducers.
> #{"threaded":true,"repeat":true,"procs":6,"sandbox":"","fault_call":-1,"tmpdir":true}
> r0 = openat$kvm(0xffffffffffffff9c, &(0x7f0000000080)='/dev/kvm\x00', 0x0, 0x0)
> r1 = ioctl$KVM_CREATE_VM(r0, 0xae01, 0x0)
> r2 = ioctl$KVM_CREATE_VCPU(r1, 0xae41, 0x0)
> ioctl$KVM_SET_VCPU_EVENTS(r2, 0x4040aea0, &(0x7f0000000000)={0x5, 0x7, 0x40, 0x0, 0x0, 0x0, 0x0, 0x492, 0x5, 0x1, 0xffff, 0x0, 0x0, 0xef, 0x100000000, 0x0, 0x100})
> ioctl$KVM_SET_USER_MEMORY_REGION(r1, 0x4020ae46, &(0x7f0000000040)={0x0, 0x0, 0x0, 0x2000, &(0x7f0000ffe000/0x2000)=nil})
> ioctl$KVM_SET_SREGS(r2, 0x4138ae84, &(0x7f00000003c0)={{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, 0x8005001f, 0x0, 0x0, 0x28, 0x0, 0x6500})
> ioctl$KVM_RUN(r2, 0xae80, 0x0)

  reply	other threads:[~2018-10-11 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10  7:52 kernel BUG at arch/x86/kvm/x86.c:LINE! (2) syzbot
2018-10-10 12:33 ` syzbot
2018-10-10 20:34 ` syzbot
2018-10-11  2:57 ` Du Changbin
2018-10-11 14:32   ` Paolo Bonzini [this message]
2018-10-11 18:05     ` Dmitry Vyukov

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=44d8f927-85bb-cde5-1ddc-93da5ea048ae@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=changbin.du@huawei.com \
    --cc=duchangbin3@huawei.com \
    --cc=dvyukov@google.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=syzbot+f9b42efadea9f5453100@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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