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: <DS0PR11MB6373806C09D92197635FF46CDCE59@DS0PR11MB6373.namprd11.prod.outlook.com>
Date:   Mon, 19 Dec 2022 13:15:40 +0000
From:   "Wang, Wei W" <wei.w.wang@...el.com>
To:     Isaku Yamahata <isaku.yamahata@...il.com>
CC:     "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        "Aktas, Erdem" <erdemaktas@...gle.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "Shahar, Sagi" <sagis@...gle.com>,
        David Matlack <dmatlack@...gle.com>
Subject: RE: [PATCH v10 052/108] KVM: x86/tdp_mmu: Ignore unsupported mmu
 operation on private GFNs

On Friday, December 16, 2022 7:21 AM, Yamahata, Isaku wrote:
> > > +	/*
> > > +	 * First TDX generation doesn't support clearing dirty bit,
> > > +	 * since there's no secure EPT API to support it.  It is a
> > > +	 * bug to reach here for TDX guest.
> > > +	 */
> > > +	if (WARN_ON_ONCE(!kvm_arch_dirty_log_supported(kvm)))
> > > +		return false;
> > > +
> >
> > It might not be a good choice to intercept everywhere in kvm_mmu just
> > as tdx doesn't support it. I'm thinking maybe we could do the check in
> > tdx.c, which is much simpler. For example:
> >
> > @@ -2592,6 +2605,12 @@ static void
> tdx_handle_changed_private_spte(struct kvm *kvm,
> >         lockdep_assert_held(&kvm->mmu_lock);
> >
> >         if (change->new.is_present) {
> > +               /* Only flags change. This isn't supported currently. */
> > +               KVM_BUG_ON(change->old.is_present, kvm);
> >
> > Then we can have kvm_arch_dirty_log_supported completely removed.
> 
> Do you mean WARN_ON_ONCE()? If so, they can be removed from this
> patches because the code should be blocked by "if
> (!kvm_arch_dirty_log_supported(kvm))" at the caller.
> 

As you also mentioned in the comment "It is a bug to reach here", we could keep using KVM_BUG_ON. The suggestion is that we don't need to add such checks in all the callers as it is more complicated (and error-prone) to consider all of them.
Why not let callers run into tdx_handle_changed_private_spte to do the check (at this only place)? From what I understand, we don’t support an spte change with flags update only for this version. This would be much simpler.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ