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:   Wed, 23 Jun 2021 20:47:59 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Yu Zhang <yu.c.zhang@...ux.intel.com>,
        Maxim Levitsky <mlevitsk@...hat.com>
Subject: Re: [PATCH 25/54] KVM: x86/mmu: Add helpers to query mmu_role bits

On Wed, Jun 23, 2021, Paolo Bonzini wrote:
> On 22/06/21 19:57, Sean Christopherson wrote:
> > +static inline bool is_##reg##_##name(struct kvm_mmu *mmu)	\
> 
> What do you think about calling these is_mmu_##name?  The point of having
> these helpers is that the register doesn't count, and they return the
> effective value (e.g. false in most EPT cases).

I strongly prefer to keep <reg> in the name, both to match the mmu_role bits and
to make it a bit more clear that it's reflective (modified) register state, as
opposed to PTEs or even something else entirely.  E.g. I always struggled to
remember the purpose of mmu->nx flag.

I wouldn't be opposed to is_mmu_##reg##_##name() though.  I omitted the "mmu"
part because it was loosely implied by the "struct kvm_mmu" param, and to keep
line lengths short.  But being explicit is usually a good thing, and looking at
the code I don't see any lines that would wrap if "mmu" were added.

> > +{								\
> > +	return !!(mmu->mmu_role. base_or_ext . reg##_##name);	\
> > +}
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr0, pg);
> > +BUILD_MMU_ROLE_ACCESSOR(base, cr0, wp);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, pse);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, pae);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, smep);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, smap);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, pke);
> > +BUILD_MMU_ROLE_ACCESSOR(ext,  cr4, la57);
> > +BUILD_MMU_ROLE_ACCESSOR(base, efer, nx);
> > +
> >   struct kvm_mmu_role_regs vcpu_to_role_regs(struct kvm_vcpu *vcpu)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ