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] [day] [month] [year] [list]
Date:   Thu, 1 Jun 2023 14:23:26 -0700
From:   Jim Mattson <jmattson@...gle.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     Jon Kohler <jon@...anix.com>, Waiman Long <longman@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Andrea Arcangeli <aarcange@...hat.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH v4] KVM: VMX: do not disable interception for
 MSR_IA32_SPEC_CTRL on eIBRS

On Thu, Jun 1, 2023 at 1:35 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Thu, Jun 01, 2023, Jim Mattson wrote:
> > On Thu, Jun 1, 2023 at 12:28 PM Jon Kohler <jon@...anix.com> wrote:
> > > > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> > > > index c544602d07a3..454bcbf5b543 100644
> > > > --- a/arch/x86/kvm/x86.h
> > > > +++ b/arch/x86/kvm/x86.h
> > > > @@ -492,7 +492,31 @@ static inline void kvm_machine_check(void)
> > > >
> > > > void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu);
> > > > void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu);
> > > > +
> > > > int kvm_spec_ctrl_test_value(u64 value);
> > > > +
> > > > +static inline bool kvm_account_msr_spec_ctrl_write(struct kvm_vcpu *vcpu)
> > > > +{
> > > > +     if ((vcpu->stat.exits - vcpu->arch.spec_ctrl_nr_exits_snapshot) < 20)
> >
> > I think you mean 200 here. If it's bad to have more than 1
> > WRMSR(IA32_SPEC_CTRL) VM-exit in 20 VM-exits, then more than 10 such
> > VM-exits in 200 VM-exits represents sustained badness.
>
> No?  The snapshot is updated on every write, i.e. this check is whether or not
> the last wrmsr(SPEC_CTRL) was less than 20 cycles ago.
>
>        if ((vcpu->stat.exits - vcpu->arch.spec_ctrl_nr_exits_snapshot) < 20)
>                vcpu->arch.nr_quick_spec_ctrl_writes++;
>        else
>                vcpu->arch.nr_quick_spec_ctrl_writes = 0;

Okay, then maybe this else clause is too aggressive. Just because we
went 21 VM-exits without seeing a WRMSR(IA32_SPEC_CTRL), we don't want
to clobber all of our history.

>        vcpu->arch.spec_ctrl_nr_exits_snapshot = vcpu->stat.exits;  <= new snapshot
>
>        return vcpu->arch.nr_quick_spec_ctrl_writes >= 10;
>
> > (Although, as Sean noted, these numbers are just placeholders.)
>
> And the logic is very off-the-cuff, e.g. it may be better to have a rolling 200-exit
> window instead of 10 somewhat independent 20-exit windows.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ