All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+744e173caec2e1627ee0@syzkaller.appspotmail.com,
	David Matlack <dmatlack@google.com>
Subject: Re: [PATCH 1/3] KVM: Properly unwind VM creation if creating debugfs fails
Date: Tue, 16 Aug 2022 17:52:32 +0000	[thread overview]
Message-ID: <YvvZYEt6hiqOTFHV@google.com> (raw)
In-Reply-To: <20220816053937.2477106-2-seanjc@google.com>

On Tue, Aug 16, 2022 at 05:39:35AM +0000, Sean Christopherson wrote:
> Properly unwind VM creation if kvm_create_vm_debugfs() fails.  A recent
> change to invoke kvm_create_vm_debug() in kvm_create_vm() was led astray

typo: kvm_create_vm_debugfs()

> by buggy try_get_module() handling adding by commit 5f6de5cbebee ("KVM:
> Prevent module exit until all VMs are freed").  The debugfs error path
> effectively inherits the bad error path of try_module_get(), e.g. KVM
> leaves the to-be-free VM on vm_list even though KVM appears to do the
> right thing by calling module_put() and falling through.
> 
> Opportunistically hoist kvm_create_vm_debugfs() above the call to
> kvm_arch_post_init_vm() so that the "post-init" arch hook is actually
> invoked after the VM is initialized (ignoring kvm_coalesced_mmio_init()
> for the moment).  x86 is the only non-nop implementation of the post-init
> hook, and it doesn't allocate/initialize any objects that are reachable
> via debugfs code (spawns a kthread worker for the NX huge page mitigation).
> 
> Leave the buggy try_get_module() alone for now, it will be fixed in a
> separate commit.
> 
> Fixes: b74ed7a68ec1 ("KVM: Actually create debugfs in kvm_create_vm()")
> Reported-by: syzbot+744e173caec2e1627ee0@syzkaller.appspotmail.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Fun times! Thanks for the fix Sean.

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>

--
Best,
Oliver

  reply	other threads:[~2022-08-16 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  5:39 [PATCH 0/3] KVM: kvm_create_vm() bug fixes and cleanup Sean Christopherson
2022-08-16  5:39 ` [PATCH 1/3] KVM: Properly unwind VM creation if creating debugfs fails Sean Christopherson
2022-08-16 17:52   ` Oliver Upton [this message]
2022-08-16  5:39 ` [PATCH 2/3] KVM: Unconditionally get a ref to /dev/kvm module when creating a VM Sean Christopherson
2022-08-16 17:01   ` David Matlack
2022-08-16 21:43     ` Sean Christopherson
2022-08-16  5:39 ` [PATCH 3/3] KVM: Move coalesced MMIO initialization (back) into kvm_create_vm() Sean Christopherson
2022-08-16 18:04   ` Oliver Upton
2022-08-16 19:23     ` Sean Christopherson
2022-08-17  9:47 ` [PATCH 0/3] KVM: kvm_create_vm() bug fixes and cleanup Paolo Bonzini

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=YvvZYEt6hiqOTFHV@google.com \
    --to=oliver.upton@linux.dev \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=syzbot+744e173caec2e1627ee0@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.