[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201023103610.facpukoiodnj5v73@box>
Date: Fri, 23 Oct 2020 13:36:10 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jmattson@...gle.com" <jmattson@...gle.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Christopherson, Sean J" <sean.j.christopherson@...el.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"joro@...tes.org" <joro@...tes.org>,
"x86@...nel.org" <x86@...nel.org>,
"aarcange@...hat.com" <aarcange@...hat.com>,
"keescook@...omium.org" <keescook@...omium.org>,
"luto@...nel.org" <luto@...nel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"liran.alon@...cle.com" <liran.alon@...cle.com>,
"rppt@...nel.org" <rppt@...nel.org>,
"wad@...omium.org" <wad@...omium.org>,
"wanpengli@...cent.com" <wanpengli@...cent.com>,
"Kleen, Andi" <andi.kleen@...el.com>
Subject: Re: [RFCv2 14/16] KVM: Handle protected memory in
__kvm_map_gfn()/__kvm_unmap_gfn()
On Thu, Oct 22, 2020 at 04:59:49PM +0000, Edgecombe, Rick P wrote:
> On Thu, 2020-10-22 at 15:06 +0300, Kirill A. Shutemov wrote:
> > > I think the page could have got unmapped since the gup via the
> > > hypercall on another CPU. It could be an avenue for the guest to
> > > crash
> > > the host.
> >
> > Hm.. I'm not sure I follow. Could you elaborate on what scenario you
> > have
> > in mind?
>
> Kind of similar scenario as the userspace triggered oops. My
> understanding is that the protected status was gathered along with the
> gup, but after the mm gets unlocked, nothing stops the page
> transitioning to unmapped(?). At which point kmap() from a previous gup
> with !protected, would go down the regular kmap() route and return an
> address to an unmapped page.
>
> So the guest kernel could start with a page mapped as shared via the
> hypercall. Then trigger one of the PV MSR's that kmap() on CPU0. On
> CPU1, after the gup on CPU0, it could transitioned the page to
> private/unmapped via the hypercall. So the hva_to_pfn() would find
> !protected, but by the time the kmap() happened the page would have
> been unmapped. Am I missing something?
We need to fail protection enabling if a page is pinned. That's the only
option I see. But it might be pain to debug.
--
Kirill A. Shutemov
Powered by blists - more mailing lists