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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230227215215.GL4175971@ls.amr.corp.intel.com>
Date:   Mon, 27 Feb 2023 13:52:15 -0800
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     "Huang, Kai" <kai.huang@...el.com>,
        "zhi.wang.linux@...il.com" <zhi.wang.linux@...il.com>,
        "sean.j.christopherson@...el.com" <sean.j.christopherson@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Shahar, Sagi" <sagis@...gle.com>,
        "isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
        "Aktas, Erdem" <erdemaktas@...gle.com>,
        "dmatlack@...gle.com" <dmatlack@...gle.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>
Subject: Re: [PATCH v11 030/113] KVM: x86/mmu: Replace hardcoded value 0 for
 the initial value for SPTE

On Thu, Jan 26, 2023 at 10:01:41PM +0000,
Sean Christopherson <seanjc@...gle.com> wrote:

> On Thu, Jan 26, 2023, Huang, Kai wrote:
> > On Wed, 2023-01-25 at 17:22 +0000, Sean Christopherson wrote:
> > > I agree that handling this in the common code would be cleaner, but repurposing
> > > gfp_zero gets kludgy because it would require a magic value to say "don't initialize
> > > the data", e.g. x86's mmu_shadowed_info_cache isn't pre-filled.
> 
> ...
> 
> > > @@ -400,6 +405,13 @@ int __kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int capacity,
> > >  		if (WARN_ON_ONCE(!capacity))
> > >  			return -EIO;
> > >  
> > > +		/*
> > > +		 * Custom init values can be used only for page allocations,
> > > +		 * and obviously conflict with __GFP_ZERO.
> > > +		 */
> > > +		if (WARN_ON_ONCE(mc->init_value && (mc->kmem_cache || mc->gfp_zero)))
> > > +			return -EIO;
> > > +
> > >  		mc->objects = kvmalloc_array(sizeof(void *), capacity, gfp);
> > >  		if (!mc->objects)
> > >  			return -ENOMEM;
> > > 
> > > base-commit: 503f0315c97739d3f8e645c500d81757dfbf76be
> > 
> > init_value and gfp_zone is kinda redundant.  How about removing gfp_zero
> > completely?
> > 
> > 	mmu_memory_cache_alloc_obj(...)
> > 	{
> > 		...
> > 		if (!mc->init_value)
> > 			gfp_flags |= __GFP_ZERO;
> > 		...
> > 	}
> > 
> > And in kvm_mmu_create() you initialize all caches' init_value explicitly.
> 
> No, as mentioned above there's also a "don't initialize the data" case.  Leaving
> init_value=0 means those users would see unnecessary zeroing, and again I don't
> want to use a magic value to say "don't initialize".

The abuses of gfp_flags as zeroing doesn't work for Secure-EPT page table.
It doesn't need zeroing without initial value.  So I used the patch as is.
-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ