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: <b61f8d7c-e8bf-476e-8d56-ce9660a13d02@zytor.com>
Date: Sun, 24 Aug 2025 18:52:55 -0700
From: Xin Li <xin@...or.com>
To: Chao Gao <chao.gao@...el.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc: bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
        john.allen@....com, mingo@...hat.com, minipli@...ecurity.net,
        mlevitsk@...hat.com, pbonzini@...hat.com, rick.p.edgecombe@...el.com,
        seanjc@...gle.com, tglx@...utronix.de, weijiang.yang@...el.com,
        x86@...nel.org
Subject: Re: [PATCH v13 05/21] KVM: x86: Load guest FPU state when access
 XSAVE-managed MSRs

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 6b01c6e9330e..799ac76679c9 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4566,6 +4569,21 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>   }
>   EXPORT_SYMBOL_GPL(kvm_get_msr_common);
>   
> +/*
> + *  Returns true if the MSR in question is managed via XSTATE, i.e. is context
> + *  switched with the rest of guest FPU state.
> + */
> +static bool is_xstate_managed_msr(u32 index)
> +{
> +	switch (index) {
> +	case MSR_IA32_U_CET:


Why MSR_IA32_S_CET is not included here?


> +	case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:
> +		return true;
> +	default:
> +		return false;
> +	}
> +}


Is it better to do?

static bool is_xstate_managed_msr(u32 index)
{
          if (!kvm_caps.supported_xss)
                  return false;

          switch (index) {
          case MSR_IA32_U_CET:
          case MSR_IA32_S_CET:
          case MSR_IA32_PL1_SSP ... MSR_IA32_PL3_SSP:
                  return kvm_caps.supported_xss & XFEATURE_MASK_CET_USER &&
                         kvm_caps.supported_xss & XFEATURE_MASK_CET_KERNEL;
          default:
                  return false;
          }
}

And it would be obvious how to add new MSRs related to other XFEATURE bits.

Thanks!
     Xin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ