From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Wanpeng Li" <wanpengli@tencent.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>
Subject: Re: [PATCH 2/2] KVM: Fix rcu splat if vm creation fails
Date: Mon, 4 Nov 2019 12:18:10 +0100 [thread overview]
Message-ID: <c32d632b-8fb0-f7c6-4937-07c30769b924@redhat.com> (raw)
In-Reply-To: <1572848879-21011-2-git-send-email-wanpengli@tencent.com>
On 04/11/19 07:27, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> Reported by syzkaller:
>
> =============================
> WARNING: suspicious RCU usage
> -----------------------------
> ./include/linux/kvm_host.h:536 suspicious rcu_dereference_check() usage!
>
> other info that might help us debug this:
>
> rcu_scheduler_active = 2, debug_locks = 1
> no locks held by repro_11/12688.
>
> stack backtrace:
> Call Trace:
> dump_stack+0x7d/0xc5
> lockdep_rcu_suspicious+0x123/0x170
> kvm_dev_ioctl+0x9a9/0x1260 [kvm]
> do_vfs_ioctl+0x1a1/0xfb0
> ksys_ioctl+0x6d/0x80
> __x64_sys_ioctl+0x73/0xb0
> do_syscall_64+0x108/0xaa0
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Commit a97b0e773e4 (kvm: call kvm_arch_destroy_vm if vm creation fails)
> sets users_count to 1 before kvm_arch_init_vm(), however, if kvm_arch_init_vm()
> fails, we need to dec this count. Or, we can move the sets refcount after
> kvm_arch_init_vm().
I don't understand this one, hasn't
WARN_ON_ONCE(!refcount_dec_and_test(&kvm->users_count));
decreased the conut already? With your patch the refcount would then
underflow.
Paolo
next prev parent reply other threads:[~2019-11-04 11:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 6:27 [PATCH 1/2] KVM: Fix NULL-ptr defer after kvm_create_vm fails Wanpeng Li
2019-11-04 6:27 ` [PATCH 2/2] KVM: Fix rcu splat if vm creation fails Wanpeng Li
2019-11-04 11:18 ` Paolo Bonzini [this message]
2019-11-04 12:16 ` Wanpeng Li
2019-11-04 12:21 ` Paolo Bonzini
2019-11-04 12:25 ` Wanpeng Li
2019-11-04 12:26 ` Paolo Bonzini
2019-11-04 11:19 ` [PATCH 1/2] KVM: Fix NULL-ptr defer after kvm_create_vm fails Paolo Bonzini
2019-11-06 8:29 ` Christian Borntraeger
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=c32d632b-8fb0-f7c6-4937-07c30769b924@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/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
all inboxes | Powered by JetHome®