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]
Date:   Thu, 4 Aug 2022 17:42:11 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     "Dr. David Alan Gilbert" <dgilbert@...hat.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Dave Young <ruyang@...hat.com>,
        Xiaoying Yan <yiyan@...hat.com>,
        David Woodhouse <dwmw@...zon.co.uk>, stable@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: revalidate steal time cache if MSR value
 changes

On Thu, Aug 04, 2022, Dr. David Alan Gilbert wrote:
> * Vitaly Kuznetsov (vkuznets@...hat.com) wrote:
> > Paolo Bonzini <pbonzini@...hat.com> writes:
> > > -		gfn_t gfn = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
> > > -
> > >  		/* We rely on the fact that it fits in a single page. */
> > >  		BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS);
> > >  
> > > -		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) ||
> > > +		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st)) ||
> > 
> > (It would be nice to somehow get at least a warning when 'gfn_t' is used
> > instead of 'gpa_t' and vice versa)
> 
> Can't sparse be taught to do that?

Hmm, it probably could, but the result would likely be a mess.  E.g. anything that
shifts the GPA on-demand will require explicit casts to make sparse happy.

This particular case is solvable without sparse, e.g. WARN if gpa[11:0]!=0, or
even better rework the function to actually take a @gfn and then WARN if the
incoming gfn would yield an illegal gpa.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ