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: <301d4800-5eab-6e21-e8c1-2f87789fc4b9@redhat.com>
Date:   Mon, 17 Jan 2022 18:31:58 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Like Xu <like.xu.linux@...il.com>
Cc:     Jing Liu <jing2.liu@...el.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Jim Mattson <jmattson@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86/cpuid: Clear XFD for component i if the base
 feature is missing

On 1/17/22 08:45, Like Xu wrote:
> From: Like Xu <likexu@...cent.com>
> 
> According to Intel extended feature disable (XFD) spec, the sub-function i
> (i > 1) of CPUID function 0DH enumerates "details for state component i.
> ECX[2] enumerates support for XFD support for this state component."
> 
> If KVM does not report F(XFD) feature (e.g. due to CONFIG_X86_64),
> then the corresponding XFD support for any state component i
> should also be removed. Translate this dependency into KVM terms.
> 
> Fixes: 690a757d610e ("kvm: x86: Add CPUID support for Intel AMX")
> Signed-off-by: Like Xu <likexu@...cent.com>
> ---
>   arch/x86/kvm/cpuid.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index c55e57b30e81..e96efef4f048 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -886,6 +886,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>   				--array->nent;
>   				continue;
>   			}
> +
> +			if (!kvm_cpu_cap_has(X86_FEATURE_XFD))
> +				entry->ecx &= ~BIT_ULL(2);
>   			entry->edx = 0;
>   		}
>   		break;

Generally this is something that is left to userspace.  Apart from the 
usecase of "call KVM_GET_SUPPORTED_CPUID and pass it to KVM_SET_CPUID2", 
userspace should know what any changed bits mean.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ