lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Dec 2022 16:31:00 -0800
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     Vishal Annapurve <vannapurve@...gle.com>
Cc:     binbin.wu@...ux.intel.com, dmatlack@...gle.com,
        erdemaktas@...gle.com, isaku.yamahata@...il.com,
        isaku.yamahata@...el.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, pbonzini@...hat.com,
        sagis@...gle.com, seanjc@...gle.com
Subject: Re: [PATCH v10 062/108] KVM: x86/tdp_mmu: implement MapGPA hypercall
 for TDX

On Fri, Dec 09, 2022 at 12:01:30AM +0000,
Vishal Annapurve <vannapurve@...gle.com> wrote:

> > +int __kvm_mmu_map_gpa(struct kvm *kvm, gfn_t *startp, gfn_t end,
> > +		      bool map_private)
> > +{
> > +	gfn_t start = *startp;
> > +	int attr;
> > +	int ret;
> > +
> > +	if (!kvm_gfn_shared_mask(kvm))
> > +		return -EOPNOTSUPP;
> > +
> > +	attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED;
> > +	start = start & ~kvm_gfn_shared_mask(kvm);
> > +	end = end & ~kvm_gfn_shared_mask(kvm);
> > +
> > +	/*
> > +	 * To make the following kvm_vm_set_mem_attr() success within spinlock
> > +	 * without memory allocation.
> > +	 */
> > +	ret = kvm_vm_reserve_mem_attr(kvm, start, end);
> > +	if (ret)
> > +		return ret;
> > +
> > +	write_lock(&kvm-> mmu_lock);
> > +	if (is_tdp_mmu_enabled(kvm)) {
> > +		gfn_t s = start;
> > +
> > +		ret = kvm_tdp_mmu_map_gpa(kvm, &s, end, map_private);
> > +		if (!ret) {
> > +			KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm);
> 
> This will result in no exits to userspace during memory conversion requests from
> guests. And as a result, userspace will not be able to explicitly back/unback
> shared/private memory during conversions leading to double allocation of memory.
> 
> Is this an intended behavior for memory conversion with TDX VMs as per earlier
> discussion?

It was because UPM ioctl interface was not stable yet. With v10, it seems mostly
stable, I'll change the patch of "[PATCH v10 101/108] KVM: TDX: Handle TDX PV
map_gpa hypercall" to exit to user space.
-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ