[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45e643bce58e0f7c9646bb6c548c4e9f026f1fa8.camel@linux.ibm.com>
Date: Thu, 28 Nov 2019 13:29:00 -0300
From: Leonardo Bras <leonardo@...ux.ibm.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Paul Mackerras <paulus@...abs.org>,
Radim Krčmář <rkrcmar@...hat.com>,
kvm-ppc@...r.kernel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: Add separate helper for putting borrowed reference
to kvm
On Wed, 2019-11-27 at 17:00 -0800, Sean Christopherson wrote:
> > Sorry, I missed some information on above example.
> > Suppose on that example that the reorder changes take place so that
> > kvm_put_kvm{,_no_destroy}() always happens after the last usage of kvm
> > (in the same syscall, let's say).
>
> That can't happen, because the ioctl() holds a reference to KVM via its
> file descriptor for /dev/kvm, and ioctl() in turn prevents the fd from
> being closed.
>
> > Before T1 and T2, refcount = 1;
>
> This is what's impossible. T1 must have an existing reference to get
> into the ioctl(), and that reference cannot be dropped until the ioctl()
> completes (and by completes I mean returns to userspace). Assuming no
> other bugs, i.e. T2 has its own reference, then refcount >= 2.
>
Thanks for explaining, I think I get it now.
Best regards,
Leonardo Bras
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists